|
41 | 41 | (wrong))"
|
42 | 42 | (expect (let ((beginning-of-defun-function nil))
|
43 | 43 | (clojure-top-level-form-p "comment"))))))
|
44 |
| - |
| 44 | +(describe "clojure--looking-at-top-level-form" |
| 45 | + (it "should return nil when point is inside a top level form" |
| 46 | + (with-clojure-buffer-point |
| 47 | + "(comment |
| 48 | + |(ns foo))" |
| 49 | + (expect (clojure--looking-at-top-level-form) :to-equal nil)) |
| 50 | + (with-clojure-buffer-point |
| 51 | + "\"|(ns foo)\"" |
| 52 | + (expect (clojure--looking-at-top-level-form) :to-equal nil)) |
| 53 | + (with-clojure-buffer-point |
| 54 | + "^{:fake-ns |(ns foo)}" |
| 55 | + (expect (clojure--looking-at-top-level-form) :to-equal nil))) |
| 56 | + (it "should return true when point is looking at a top level form" |
| 57 | + (with-clojure-buffer-point |
| 58 | + "(comment |
| 59 | + |(ns foo))" |
| 60 | + (expect (clojure--looking-at-top-level-form (point-min)) :to-equal t)) |
| 61 | + (with-clojure-buffer-point |
| 62 | + "|(ns foo)" |
| 63 | + (expect (clojure--looking-at-top-level-form) :to-equal t)))) |
45 | 64 | (describe "clojure-beginning-of-defun-function"
|
46 | 65 | (it "should go to top level form"
|
47 | 66 | (with-clojure-buffer-point
|
|
164 | 183 | (expect (equal "baz-quux" (clojure-find-ns))))
|
165 | 184 | (let ((data
|
166 | 185 | '(("\"\n(ns foo-bar)\"\n" "(in-ns 'baz-quux)" "baz-quux")
|
167 |
| - (";(ns foo-bar)\n" "(in-ns 'baz-quux)" "baz-quux") |
| 186 | + (";(ns foo-bar)\n" "(in-ns 'baz-quux2)" "baz-quux2") |
168 | 187 | ("(ns foo-bar)\n" "\"\n(in-ns 'baz-quux)\"" "foo-bar")
|
169 |
| - ("(ns foo-bar)\n" ";(in-ns 'baz-quux)" "foo-bar")))) |
| 188 | + ("(ns foo-bar2)\n" ";(in-ns 'baz-quux)" "foo-bar2")))) |
170 | 189 | (pcase-dolist (`(,form1 ,form2 ,expected) data)
|
171 | 190 | (with-clojure-buffer form1
|
172 | 191 | (save-excursion (insert form2))
|
|
0 commit comments