Skip to content

Fix breaks with running current set of unit tests on GH #3532

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions test/cider-client-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -136,30 +136,30 @@
(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)))
(spy-on 'file-relative-name :and-call-fake (lambda (file dir)
(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)
Expand Down
35 changes: 18 additions & 17 deletions test/cider-eval-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down