Skip to content

Commit c433916

Browse files
committed
Don't cache ns in the test for clojure-find-ns
The test uses a file with two namespaces in one source file, which doesn't work properly with ns caching.
1 parent 8fab875 commit c433916

File tree

1 file changed

+20
-18
lines changed

1 file changed

+20
-18
lines changed

test/clojure-mode-sexp-test.el

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -76,24 +76,26 @@
7676
(newline-and-indent)))
7777

7878
(ert-deftest clojure-find-ns-test ()
79-
(with-temp-buffer
80-
(insert "(ns ^{:doc \"Some docs\"}\nfoo-bar)")
81-
(newline)
82-
(newline)
83-
(insert "(in-ns 'baz-quux)")
84-
(clojure-mode)
85-
86-
;; From inside docstring of first ns
87-
(goto-char 18)
88-
(should (equal "foo-bar" (clojure-find-ns)))
89-
90-
;; From inside first ns's name, on its own line
91-
(goto-char 29)
92-
(should (equal "foo-bar" (clojure-find-ns)))
93-
94-
;; From inside second ns's name
95-
(goto-char 42)
96-
(should (equal "baz-quux" (clojure-find-ns)))))
79+
;; we should not cache the results of `clojure-find-ns' here
80+
(let ((clojure-cache-ns nil))
81+
(with-temp-buffer
82+
(insert "(ns ^{:doc \"Some docs\"}\nfoo-bar)")
83+
(newline)
84+
(newline)
85+
(insert "(in-ns 'baz-quux)")
86+
(clojure-mode)
87+
88+
;; From inside docstring of first ns
89+
(goto-char 18)
90+
(should (equal "foo-bar" (clojure-find-ns)))
91+
92+
;; From inside first ns's name, on its own line
93+
(goto-char 29)
94+
(should (equal "foo-bar" (clojure-find-ns)))
95+
96+
;; From inside second ns's name
97+
(goto-char 42)
98+
(should (equal "baz-quux" (clojure-find-ns))))))
9799

98100
(provide 'clojure-mode-sexp-test)
99101

0 commit comments

Comments
 (0)