Skip to content

Commit 77ae0f5

Browse files
committed
Some clarifying tests, some fail
1 parent ad18cf2 commit 77ae0f5

File tree

1 file changed

+70
-5
lines changed

1 file changed

+70
-5
lines changed

test/enh-ruby-mode-test.el

Lines changed: 70 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,23 +41,88 @@
4141
(enh-ruby-backward-sexp 1)
4242
(line-should-equal "def foo")))
4343

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 ()
4553
:expected-result :failed
4654
(with-temp-enh-rb-string
4755
"def backward_sexp\n \"string #{expr \"another\"} word\"\nend\n"
4856

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
49100
(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+
))
53118

54119
(enh-deftest enh-ruby-forward-sexp-test ()
55120
(with-temp-enh-rb-string
56121
"def foo\n xxx\n end\n\ndef backward_sexp\n xxx\nend\n"
57122

58123
(enh-ruby-forward-sexp 1)
59124
(forward-char 2)
60-
(line-should-equal "def backward_sexp")))
125+
(rest-of-line-should-equal "def backward_sexp")))
61126

62127
(enh-deftest enh-ruby-up-sexp-test ()
63128
(with-temp-enh-rb-string

0 commit comments

Comments
 (0)