Skip to content

Commit 7c72e95

Browse files
vemvbbatsov
authored andcommitted
Upgrade and satisfy Eastwood
1 parent f8e081f commit 7c72e95

File tree

6 files changed

+39
-36
lines changed

6 files changed

+39
-36
lines changed

project.clj

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,8 @@
138138
try-if-let [[:block 1]]}}}]
139139

140140
:eastwood [:test
141-
{:plugins [[jonase/eastwood "0.3.11"]]
141+
{:plugins [[jonase/eastwood "0.4.0"]]
142142
:eastwood {:config-files ["eastwood.clj"]
143-
;; TODO: Add :test-paths once
144-
;; https://github.com/jonase/eastwood/issues/298
145-
;; is resolved
146-
:namespaces [:source-paths]}}]})
143+
:exclude-namespaces [cider.nrepl.middleware.test-filter-tests]
144+
:ignored-faults {:unused-ret-vals-in-try {cider.nrepl.middleware.profile-test [{:line 25}]}
145+
:suspicious-test {cider.nrepl.middleware.profile-test [{:line 25}]}}}}]})

test/clj/cider/nrepl/middleware/slurp_test.clj

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66
[clojure.string :as str]))
77

88
(t/deftest test-project-clj-is-clj
9-
(let [resp (slurp-url-to-content+body
10-
(.toString
11-
(.toURL
12-
(io/file "project.clj"))))]
9+
(let [resp (-> "project.clj"
10+
io/file
11+
io/as-url
12+
.toString
13+
slurp-url-to-content+body)]
1314
(t/is (= ["text/clojure" {}] (:content-type resp)))
1415
(t/is (not= "base64" (:content-transfer-encoding resp)))))
1516

@@ -28,8 +29,11 @@
2829
(t/is (str/ends-with? (:body resp) ",size=681]"))))
2930

3031
(t/deftest test-directory
31-
(let [resp (slurp-url-to-content+body
32-
(.toString (.toURL (io/file "test"))))]
32+
(let [resp (-> "test"
33+
io/file
34+
io/as-url
35+
.toString
36+
slurp-url-to-content+body)]
3337
(t/is (= ["application/octet-stream" {}] (:content-type resp)))
3438
(t/is (str/starts-with? (:body resp) "#binary[location="))
3539
(t/is (str/ends-with? (:body resp) ",size=0]"))))

test/clj/cider/nrepl/middleware/stacktrace_test.clj

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -153,20 +153,21 @@
153153
(extract-location {:class "clojure.lang.Compiler$CompilerException"
154154
:message "java.lang.NegativeArraySizeException, compiling:(/foo/bar/baz.clj:1:42)"}))))
155155
(testing "extract-location with location-data already present"
156-
(= {:class "clojure.lang.Compiler$CompilerException"
157-
:message "Syntax error macroexpanding clojure.core/let at (1:1)."
158-
:file nil
159-
:file-url nil
160-
:path "/foo/bar/baz.clj"
161-
:line 1
162-
:column 42}
163-
(extract-location {:class "clojure.lang.Compiler$CompilerException"
164-
:location {:clojure.error/line 1
165-
:clojure.error/column 42
166-
:clojure.error/source "/foo/bar/baz.clj"
167-
:clojure.error/phase :macroexpand
168-
:clojure.error/symbol 'clojure.core/let}
169-
:message "Syntax error macroexpanding clojure.core/let at (1:1)."}))))
156+
(is (= {:class "clojure.lang.Compiler$CompilerException"
157+
:location '#:clojure.error{:line 1, :column 42, :source "/foo/bar/baz.clj", :phase :macroexpand, :symbol clojure.core/let},
158+
:message "Syntax error macroexpanding clojure.core/let at (1:1)."
159+
:file "/foo/bar/baz.clj"
160+
:file-url nil
161+
:path "/foo/bar/baz.clj"
162+
:line 1
163+
:column 42}
164+
(extract-location {:class "clojure.lang.Compiler$CompilerException"
165+
:location {:clojure.error/line 1
166+
:clojure.error/column 42
167+
:clojure.error/source "/foo/bar/baz.clj"
168+
:clojure.error/phase :macroexpand
169+
:clojure.error/symbol 'clojure.core/let}
170+
:message "Syntax error macroexpanding clojure.core/let at (1:1)."})))))
170171

171172
(deftest analyze-cause-test
172173
(testing "check that location-data is returned"

test/clj/cider/nrepl/middleware/util/instrument_test.clj

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,5 @@
178178
;; This is because Namespace objects implement IMeta, but not IObj.
179179
(let [an-ns (create-ns (with-meta 'foo.bar {:doc "ns docstring"}))]
180180
(binding [*ns* an-ns]
181-
(t/breakpoint-tester '(let [x (cider.nrepl.middleware.util.instrument-test/ns-embedding-macro)] x))
182-
;; If the above did not throw, then we pass
183-
(is true))))
181+
(is (some? (t/breakpoint-tester '(let [x (cider.nrepl.middleware.util.instrument-test/ns-embedding-macro)] x)))
182+
"Does not throw-exceptions"))))

test/clj/cider/nrepl/version_test.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
(ns cider.nrepl.middleware.version-test
1+
(ns cider.nrepl.version-test
22
(:require
33
[cider.nrepl.version :as v]
44
[clojure.test :refer :all]))

test/spec/cider/nrepl/middleware/stacktrace_spec_test.clj

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@
3030
(s/def ::person (s/keys :req [::first-name ::last-name ::email]
3131
:opt [::phone]))
3232

33-
(deftest spec-assert-stacktrace-test
33+
(def broken-musk {::first-name "Elon"
34+
::last-name "Musk"
35+
::email "n/a"})
3436

35-
(def broken-musk {::first-name "Elon"
36-
::last-name "Musk"
37-
::email "n/a"})
37+
(def broken-musk-causes
38+
(causes
39+
`(s/assert ::person broken-musk)))
3840

39-
(def broken-musk-causes
40-
(causes
41-
`(s/assert ::person broken-musk)))
41+
(deftest spec-assert-stacktrace-test
4242

4343
(testing "Spec assert components"
4444
(is (= 1 (count broken-musk-causes)))

0 commit comments

Comments
 (0)