|
41 | 41 | (enh-ruby-backward-sexp 1) |
42 | 42 | (line-should-equal "def foo"))) |
43 | 43 |
|
44 | | -(enh-deftest enh-ruby-backward-sexp-test-inner () |
| 44 | +(enh-deftest enh-ruby-backward-sexp-test--ruby () |
| 45 | + (with-temp-ruby-string |
| 46 | + "def foo\n xxx\nend\n" |
| 47 | + |
| 48 | + (goto-char (point-max)) |
| 49 | + (enh-ruby-backward-sexp 1) |
| 50 | + (rest-of-line-should-equal "def foo"))) |
| 51 | + |
| 52 | +(enh-deftest enh-ruby-backward-sexp-test-inner--erm () |
45 | 53 | :expected-result :failed |
46 | 54 | (with-temp-enh-rb-string |
47 | 55 | "def backward_sexp\n \"string #{expr \"another\"} word\"\nend\n" |
48 | 56 |
|
| 57 | + ;; DESIRED: |
| 58 | + ;; def backward_sexp\n \"string #{expr \"another\"} word\"\nend\n |
| 59 | + ;; ^ HERE |
| 60 | + ;; ^ to here |
| 61 | + ;; ^ to here |
| 62 | + ;; ^ to here |
| 63 | + ;; ^ to here |
| 64 | + |
| 65 | + (search-forward " word") |
| 66 | + (rest-of-line-should-equal "\"") |
| 67 | + |
| 68 | + ;; DESIRED: |
| 69 | + (enh-ruby-backward-sexp) |
| 70 | + (rest-of-line-should-equal "word\"") |
| 71 | + ;; (enh-ruby-backward-sexp) |
| 72 | + ;; (rest-of-line-should-equal "#{expr \"another\"} word\"") |
| 73 | + ;; (enh-ruby-backward-sexp) |
| 74 | + ;; (rest-of-line-should-equal "\"string #{expr \"another\"} word\"") |
| 75 | + ;; (enh-ruby-backward-sexp) |
| 76 | + ;; (rest-of-line-should-equal "def backward_sexp") |
| 77 | + |
| 78 | + ;; CURRENT: |
| 79 | + ;; def backward_sexp\n \"string #{expr \"another\"} word\"\nend\n |
| 80 | + ;; ^ HERE |
| 81 | + ;; ^ to here |
| 82 | + ;; ^ to here |
| 83 | + |
| 84 | + ;; CURRENT: |
| 85 | + |
| 86 | + (enh-ruby-backward-sexp) |
| 87 | + (rest-of-line-should-equal "{expr \"another\"} word\"") |
| 88 | + |
| 89 | + (enh-ruby-backward-sexp) |
| 90 | + (rest-of-line-should-equal "def backward_sexp") |
| 91 | + )) |
| 92 | + |
| 93 | +(enh-deftest enh-ruby-backward-sexp-test-inner--ruby () |
| 94 | + :expected-result :failed |
| 95 | + (with-temp-ruby-string |
| 96 | + "def backward_sexp\n \"string #{expr \"another\"} word\"\nend\n" |
| 97 | + ;; ^ here |
| 98 | + ;; ^ to here |
| 99 | + ;;^ NOT HERE |
49 | 100 | (search-forward " word") |
50 | | - (move-end-of-line nil) |
51 | | - (enh-ruby-backward-sexp 2) |
52 | | - (line-should-equal "\"string #{expr \"another\"} word\""))) |
| 101 | + ;; (move-end-of-line nil) |
| 102 | + |
| 103 | + (rest-of-line-should-equal "\"") |
| 104 | + |
| 105 | + (enh-ruby-backward-sexp) |
| 106 | + (rest-of-line-should-equal "word\"") |
| 107 | + |
| 108 | + (enh-ruby-backward-sexp) |
| 109 | + (rest-of-line-should-equal "{expr \"another\"} word\"") |
| 110 | + |
| 111 | + (enh-ruby-backward-sexp) |
| 112 | + (rest-of-line-should-equal "string #{expr \"another\"} word\"") |
| 113 | + |
| 114 | + ;; this blows out: (scan-error "Containing expression ends prematurely" 21 21) |
| 115 | + ;; (enh-ruby-backward-sexp) |
| 116 | + ;; (rest-of-line-should-equal "\"string #{expr \"another\"} word\"") |
| 117 | + )) |
53 | 118 |
|
54 | 119 | (enh-deftest enh-ruby-forward-sexp-test () |
55 | 120 | (with-temp-enh-rb-string |
56 | 121 | "def foo\n xxx\n end\n\ndef backward_sexp\n xxx\nend\n" |
57 | 122 |
|
58 | 123 | (enh-ruby-forward-sexp 1) |
59 | 124 | (forward-char 2) |
60 | | - (line-should-equal "def backward_sexp"))) |
| 125 | + (rest-of-line-should-equal "def backward_sexp"))) |
61 | 126 |
|
62 | 127 | (enh-deftest enh-ruby-up-sexp-test () |
63 | 128 | (with-temp-enh-rb-string |
|
0 commit comments