diff --git a/test/cider-client-tests.el b/test/cider-client-tests.el index 505067397..1411827ab 100644 --- a/test/cider-client-tests.el +++ b/test/cider-client-tests.el @@ -136,7 +136,7 @@ (before-each (spy-on 'cider-connected-p :and-return-value t) (spy-on 'cider-classpath-entries :and-return-value - '("/a" "/b" "/c" "/c/inner" "/base/clj" "/base/clj-dev")) + '("/cider--a" "/cider--b" "/cider--c" "/cider--c/inner" "/cider--base/clj" "/cider--base/clj-dev")) (spy-on 'file-directory-p :and-return-value t) (spy-on 'file-in-directory-p :and-call-fake (lambda (file dir) (string-prefix-p dir file))) @@ -144,22 +144,22 @@ (substring file (+ 1 (length dir)))))) (it "returns the namespace matching the given string path" - (expect (cider-expected-ns "/a/foo/bar/baz_utils.clj") :to-equal + (expect (cider-expected-ns "/cider--a/foo/bar/baz_utils.clj") :to-equal "foo.bar.baz-utils") - (expect (cider-expected-ns "/b/foo.clj") :to-equal + (expect (cider-expected-ns "/cider--b/foo.clj") :to-equal "foo") - (expect (cider-expected-ns "/c/inner/foo/bar.clj") :to-equal + (expect (cider-expected-ns "/cider--c/inner/foo/bar.clj") :to-equal ;; NOT inner.foo.bar "foo.bar") - (expect (cider-expected-ns "/c/foo/bar/baz") :to-equal + (expect (cider-expected-ns "/cider--c/foo/bar/baz") :to-equal "foo.bar.baz") - (expect (cider-expected-ns "/base/clj-dev/foo/bar.clj") :to-equal + (expect (cider-expected-ns "/cider--base/clj-dev/foo/bar.clj") :to-equal "foo.bar") - (expect (cider-expected-ns "/not/in/classpath.clj") :to-equal - (clojure-expected-ns "/not/in/classpath.clj"))) + (expect (cider-expected-ns "/cider--not/in/classpath.clj") :to-equal + (clojure-expected-ns "/cider--not/in/classpath.clj"))) (it "returns nil if it cannot find the namespace" - (expect (cider-expected-ns "/z/abc/def") :to-equal "")) + (expect (cider-expected-ns "/cider--z/abc/def") :to-equal "")) (it "falls back on `clojure-expected-ns' in the absence of an active nREPL connection" (spy-on 'cider-connected-p :and-return-value nil) diff --git a/test/cider-eval-tests.el b/test/cider-eval-tests.el index 60fc4a8bf..b411d6413 100644 --- a/test/cider-eval-tests.el +++ b/test/cider-eval-tests.el @@ -31,23 +31,24 @@ ;; Please, for each `describe', ensure there's an `it' block, so that its execution is visible in CI. (describe "cider-provide-file" - (it "returns an empty string when the file is not found" - (expect (cider-provide-file "abc.clj") :to-equal "")) - (it "base64 encodes without newlines" - (let ((cider-sideloader-path (list "/tmp")) - (default-directory "/tmp") - (filename (make-temp-file "abc.clj"))) - (with-temp-file filename - (dotimes (_ 60) (insert "x"))) - (expect (cider-provide-file filename) :not :to-match "\n"))) - (it "can handle multibyte characters" - (let ((cider-sideloader-path (list "/tmp")) - (default-directory "/tmp") - (filename (make-temp-file "abc.clj")) - (coding-system-for-write 'utf-8-unix)) - (with-temp-file filename - (insert "🍻")) - (expect (cider-provide-file filename) :to-equal "8J+Nuw==")))) + (let ((tmp-dir (temporary-file-directory))) + (it "returns an empty string when the file is not found" + (expect (cider-provide-file "abc.clj") :to-equal "")) + (it "base64 encodes without newlines" + (let ((cider-sideloader-path (list tmp-dir)) + (default-directory tmp-dir) + (filename (make-temp-file "abc.clj"))) + (with-temp-file filename + (dotimes (_ 60) (insert "x"))) + (expect (cider-provide-file filename) :not :to-match "\n"))) + (it "can handle multibyte characters" + (let ((cider-sideloader-path (list tmp-dir)) + (default-directory tmp-dir) + (filename (make-temp-file "abc.clj")) + (coding-system-for-write 'utf-8-unix)) + (with-temp-file filename + (insert "🍻")) + (expect (cider-provide-file filename) :to-equal "8J+Nuw=="))))) (describe "cider-extract-error-info" (it "Matches Clojure compilation exceptions"