Skip to content

Commit eff2d42

Browse files
dpsuttonbbatsov
authored andcommitted
[Fix #351] Standardize test names (#366)
1 parent 81a2e1f commit eff2d42

37 files changed

+148
-146
lines changed

test/clj/cider/nrepl/middleware/apropos_test.clj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
(is (= (var-doc #'public-var) "Test1. Test2. Test3."))
1313
(is (= (var-doc 1 #'public-var) "Test1.")))
1414

15-
(deftest test-namespaces
15+
(deftest namespaces-test
1616
(let [ns (-> *ns* ns-name str)]
1717
(testing "Namespace sort order"
1818
(is (= (-> (namespaces ns nil) first ns-name str)
@@ -32,7 +32,7 @@
3232
(is (not-any? #(re-find #".*nrepl" (str (ns-name %)))
3333
(namespaces nil nil [".*nrepl"]))))))
3434

35-
(deftest test-search
35+
(deftest search-test
3636
(testing "Search results"
3737
(is (empty? (find-symbols nil "xxxxxxxx" nil false false false nil))
3838
"Failing searches should return empty.")

test/clj/cider/nrepl/middleware/classpath_test.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
(is (every? string? classpaths))
1313
(is (some #(re-find #".*clojure-.*jar" %) classpaths))))
1414

15-
(deftest error-handling
15+
(deftest error-handling-test
1616
(with-redefs [cp/classpath (fn [] (throw (Exception. "cp error")))]
1717
(let [response (session/message {:op "classpath"})]
1818
(is (= (:status response) #{"done" "classpath-error"}))

test/clj/cider/nrepl/middleware/complete_test.clj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
(is (= '("[name & opts+sigs]") (:arglists candidate)))
5757
(is (string? (:doc candidate))))))
5858

59-
(deftest complete-doc
59+
(deftest complete-doc-test
6060
(testing "blank"
6161
(let [response (session/message {:op "complete-doc" :symbol ""})]
6262
(is (= #{"done"} (:status response)))
@@ -67,7 +67,7 @@
6767
(is (= (:status response) #{"done"}))
6868
(is (.startsWith (:completion-doc response) "clojure.core/true?\n([x")))))
6969

70-
(deftest error-handling
70+
(deftest error-handling-test
7171
(testing "complete op error handling"
7272
(with-redefs [c/complete (fn [& _] (throw (Exception. "complete-exc")))]
7373
(let [response (session/message {:op "complete" :ns "doesn't matter" :symbol "fake"})]

test/clj/cider/nrepl/middleware/debug_integration_test.clj

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@
130130
(f)))))
131131

132132

133-
(deftest debug-expression
133+
(deftest debug-expression-test
134134
(testing "normal eval (no debugging)"
135135
(--> :eval "(+ 2 3)")
136136
(<-- {:value "5"})
@@ -155,7 +155,7 @@
155155
(<-- {:value "2"}) ; (let ...)
156156
(<-- {:status ["done"]})))
157157

158-
(deftest debug-ops
158+
(deftest debug-ops-test
159159
(--> :eval "(ns user.test.debug)")
160160
(<-- {:ns "user.test.debug"})
161161
(<-- {:status ["done"]})
@@ -217,7 +217,7 @@
217217
(<-- {:value "8"})
218218
(<-- {:status ["done"]})))
219219

220-
(deftest call-instrumented-fn-when-stepping-out
220+
(deftest call-instrumented-fn-when-stepping-out-test
221221
;; When we step out of a form, instrumented functions that are
222222
;; called should still be debugged.
223223

@@ -259,7 +259,7 @@
259259
(<-- {:value "10"})
260260
(<-- {:status ["done"]}))
261261

262-
(deftest call-instrumented-fn-when-doing-here-op
262+
(deftest call-instrumented-fn-when-doing-here-op-test
263263
;; When we jump ahead by doing a `:here`, instrumented functions
264264
;; that are called from the skipped-over code should still be
265265
;; debugged.
@@ -307,7 +307,7 @@
307307

308308
;;; Tests for force-step operations
309309

310-
(deftest force-step-out-past-instrumented-fn
310+
(deftest force-step-out-past-instrumented-fn-test
311311
;; When we force-step out of a form, instrumented functions that are
312312
;; called should not be debugged.
313313

@@ -345,7 +345,7 @@
345345
(<-- {:value "14"})
346346
(<-- {:status ["done"]}))
347347

348-
(deftest force-here-past-instrumented-fn
348+
(deftest force-here-past-instrumented-fn-test
349349
;; When we do force-here operation that jumps past a call to an
350350
;; instrumented function, the function should not be debugged.
351351

@@ -385,7 +385,7 @@
385385

386386
;;; Tests for conditional breakpoints
387387

388-
(deftest conditional-in-for
388+
(deftest conditional-in-for-test
389389
(--> :eval
390390
"(for [i (range 5)]
391391
#dbg ^{:break/when (= 2 i)}
@@ -397,7 +397,7 @@
397397
(<-- {:value "(1 2 3 4 5)"}) ; (for ...)
398398
(<-- {:status ["done"]}))
399399

400-
(deftest conditional-in-defn
400+
(deftest conditional-in-defn-test
401401
(--> :eval "(ns user.test.conditional-break)")
402402
(<-- {:ns "user.test.conditional-break"})
403403
(<-- {:status ["done"]})
@@ -421,7 +421,7 @@
421421
(<-- {:value "(1 2 3)"})
422422
(<-- {:status ["done"]}))
423423

424-
(deftest call-instrumented-fn-from-skipped-break
424+
(deftest call-instrumented-fn-from-skipped-break-test
425425
;; When breaks are skipped due to a false conditional, instrumented
426426
;; functions called from withing the skipped form should still be
427427
;; debugged.
@@ -468,7 +468,7 @@
468468
(<-- {:value "(2 3)"})
469469
(<-- {:status ["done"]}))
470470

471-
(deftest step-in-to-function-in-current-project
471+
(deftest step-in-to-function-in-current-project-test
472472
;; We use misc/as-sym just because it's a simple function that's part of the
473473
;; current project, and we want to ensure that the debugger can find and
474474
;; instrument the code of a function that lives in a regular file on the
@@ -542,7 +542,7 @@
542542
(<-- {:value "blah"})
543543
(<-- {:status ["done"]})))
544544

545-
(deftest step-in-to-function-in-jar
545+
(deftest step-in-to-function-in-jar-test
546546
;; Step into clojure.tools.nrepl.server/handle*. To do this, we need to find
547547
;; and instrument the source, which is in a jar file. Note that this function
548548
;; is used because it is not marked as a :source-dep, so we can rely on the

test/clj/cider/nrepl/middleware/debug_test.clj

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
(def ^:const bfkey :cider.nrepl.middleware.util.instrument/breakfunction)
99

10-
(deftest irrelevant-return-value
10+
(deftest irrelevant-return-value-test
1111
(are [x] (let [exp (clojure.walk/macroexpand-all x)]
1212
(= exp (clojure.walk/macroexpand-all `(d/breakpoint-if-interesting ~exp [] nil))))
1313
'(defn name "" [] (inc 2))
@@ -16,7 +16,7 @@
1616
'(fn name [] (inc 2))
1717
'(fn* name ([] (inc 2)))))
1818

19-
(deftest coord<
19+
(deftest coord<-test
2020
(are [a b] (and (d/coord< a b)
2121
(not (d/coord< b a)))
2222
[1] []
@@ -25,7 +25,7 @@
2525
[1 2] [1 3]
2626
[1 0] [1]))
2727

28-
(deftest skip-breaks
28+
(deftest skip-breaks-test
2929
(binding [d/*skip-breaks* (atom {:mode :all})]
3030
(is (#'d/skip-breaks? []))
3131
(is (#'d/skip-breaks? nil))
@@ -92,7 +92,7 @@
9292
(with-redefs [t/send (send-override :inject)]
9393
(is (= :inject (#'d/read-debug-command 'value {})))))
9494

95-
(deftest read-debug-command-eval
95+
(deftest read-debug-command-eval-test
9696
(let [replies (atom [:eval 100 :next])]
9797
(with-redefs [t/send (fn [trans {:keys [key]}]
9898
(deliver (@d/promises key) (first @replies))
@@ -106,7 +106,7 @@
106106
`(binding [d/*locals* ~(#'d/sanitize-env &env)]
107107
~value))
108108

109-
(deftest read-debug-eval-expression
109+
(deftest read-debug-eval-expression-test
110110
(reset! d/debugger-message {})
111111
(let [x 1]
112112
(with-redefs [t/send (send-override '(inc 10))]
@@ -122,7 +122,7 @@
122122
(with-locals
123123
(#'d/eval-with-locals '(inc x)))))))
124124

125-
(deftest eval-with-locals-exceptions
125+
(deftest eval-with-locals-exceptions-test
126126
(binding [*msg* {:session (atom {})}]
127127
(let [e (Exception. "HI")
128128
resp (atom nil)]
@@ -132,7 +132,7 @@
132132
(is (coll? (:causes @resp)))
133133
(is (= "HI" (:message (last (:causes @resp)))))))))
134134

135-
(deftest initialize
135+
(deftest initialize-test
136136
(with-redefs [d/debugger-message (atom nil)]
137137
(let [resp (atom nil)]
138138
(with-redefs [t/send (fn [_ response] (reset! resp response))]
@@ -144,15 +144,15 @@
144144
(#'d/initialize {:hi true}))
145145
(is (:status @resp)))))
146146

147-
(deftest locals-for-message
147+
(deftest locals-for-message-test
148148
(let [x 1
149149
to_ignore 0
150150
to__ignore 0]
151151
(with-locals
152152
(is (= '(("x" "1"))
153153
(#'d/locals-for-message d/*locals*))))))
154154

155-
(deftest eval-expression-with-code
155+
(deftest eval-expression-with-code-test
156156
(with-locals
157157
(is (= (#'d/read-debug-eval-expression
158158
"Unused prompt" {:some "random", 'meaningless :map} '(inc 1))
@@ -163,37 +163,37 @@
163163
"Unused prompt" {:some "random", 'meaningless :map} '(inc x))
164164
11)))))
165165

166-
(deftest inspect-then-read-command
166+
(deftest inspect-then-read-command-test
167167
(with-redefs [d/debugger-message (atom {:session (atom {})})
168168
d/read-debug-command vector]
169169
(let [[v m] (#'d/inspect-then-read-command :value {} 32 10)]
170170
(is (= v :value))
171171
(is (string? (:inspect m))))))
172172

173-
(deftest debug-reader
173+
(deftest debug-reader-test
174174
(is (empty? (remove #(bfkey (meta %))
175175
(d/debug-reader '[a b c]))))
176176
(is (bfkey (meta (d/debug-reader '[a b c]))))
177177
(is (= (count (remove #(bfkey (meta %))
178178
(d/debug-reader '[a :b 10])))
179179
2)))
180180

181-
(deftest breakpoint-reader
181+
(deftest breakpoint-reader-test
182182
(is (bfkey (meta (d/breakpoint-reader '[a b c]))))
183183
(is (= '[a :b 10 "ok"]
184184
(remove #(bfkey (meta %)) (d/breakpoint-reader '[a :b 10 "ok"]))))
185185
;; Just don't error
186186
(is (map d/breakpoint-reader '[a :b 10 "ok"])))
187187

188-
(deftest reader-macros
188+
(deftest reader-macros-test
189189
(binding [*data-readers* {'dbg d/debug-reader}]
190190
;; Reader macro variants
191191
(is (empty? (remove #(bfkey (meta %)) (read-string "#dbg [a b c]"))))
192192
(is (bfkey (meta (read-string "#dbg [a b c]"))))
193193
(is (= (count (remove #(bfkey (meta %)) (read-string "#dbg [a :b 10]")))
194194
2))))
195195

196-
(deftest pr-short
196+
(deftest pr-short-test
197197
(reset! d/print-length 4)
198198
(reset! d/print-level 2)
199199
(is (< (count (d/pr-short [1 2 3 4 5 6 7 8 9 10]))

test/clj/cider/nrepl/middleware/format_test.clj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252

5353
(use-fixtures :once session/session-fixture)
5454

55-
(deftest test-format-code-op
55+
(deftest format-code-op-test
5656
(testing "format-code works"
5757
(let [{:keys [formatted-code status]} (session/message {:op "format-code"
5858
:code ugly-code-sample})]
@@ -66,7 +66,7 @@
6666
(is (.startsWith err "clojure.lang.ExceptionInfo: Invalid"))
6767
(is (= ex "class clojure.lang.ExceptionInfo")))))
6868

69-
(deftest test-format-edn-op
69+
(deftest format-edn-op-test
7070
(testing "format-edn works"
7171
(let [{:keys [formatted-edn status]} (session/message {:op "format-edn"
7272
:edn ugly-edn-sample})]

test/clj/cider/nrepl/middleware/info_test.clj

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
[x]
1919
(:resource (info/file-info x)))
2020

21-
(deftest test-javadoc-url
21+
(deftest javadoc-url-test
2222
(testing "java 1.7"
2323
(is (= "http://docs.oracle.com/javase/7/docs/api/java/lang/StringBuilder.html#charAt(int)"
2424
(with-redefs [util/java-api-version "7"]
@@ -33,7 +33,7 @@
3333
(info/format-response)
3434
(get "javadoc")))))))
3535

36-
(deftest test-resource-path
36+
(deftest resource-path-test
3737
(is (= (class (file (subs (str (clojure.java.io/resource "clojure/core.clj")) 4)))
3838
java.net.URL))
3939
(is (= (class (file "clojure/core.clj"))
@@ -46,7 +46,7 @@
4646
(is (nil? (relative "notclojure/core.clj")))
4747
(is (nil? (info/resource-path "jar:file:fake.jar!/fake/file.clj"))))
4848

49-
(deftest test-boot-resource-path
49+
(deftest boot-resource-path-test
5050
(let [tmp-dir-name (System/getProperty "java.io.tmpdir")
5151
tmp-file-name "boot-test.txt"
5252
tmp-file-path (str tmp-dir-name (System/getProperty "file.separator") tmp-file-name)]
@@ -75,7 +75,7 @@
7575

7676
(deftype T [])
7777

78-
(deftest test-info
78+
(deftest info-test
7979
(is (info/info-clj 'cider.nrepl.middleware.info 'io))
8080

8181
(is (info/info-clj 'cider.nrepl.middleware.info 'info-clj))
@@ -126,7 +126,7 @@
126126

127127
;; test CLJX resolve
128128
(is (= "simple/test/workaround.cljx"
129-
(-> (info/info-clj 'cider.nrepl.middleware.info-test 'test-info)
129+
(-> (info/info-clj 'cider.nrepl.middleware.info-test 'info-test)
130130
info/handle-cljx-sources
131131
:file)))
132132

@@ -138,7 +138,7 @@
138138
;; this is a replacement for (is (not (thrown? ..)))
139139
(is (nil? (info/info {:class "Thread" :member "UncaughtExceptionHandler"}))))
140140

141-
(deftest test-response
141+
(deftest response-test
142142
(let [v (ns-resolve 'cider.nrepl.middleware.info 'assoc)
143143
{:keys [arglists column line added static doc]} (meta v)]
144144
(is (= (dissoc (info/format-response (info/info-clj 'cider.nrepl.middleware.info 'assoc)) "file")
@@ -176,7 +176,7 @@
176176
[Classname/staticMethod args*]
177177
[Classname/staticField]))))
178178

179-
(deftest test-format-arglists
179+
(deftest format-arglists-test
180180
(is (= (info/format-arglists (info/extract-arglists test-eldoc-info)) '(["x"] ["x" "y"])))
181181
(is (= (info/format-arglists (info/extract-arglists test-eldoc-info-candidates))
182182
'([] ["x"] ["x" "y" "z"]))))
@@ -187,7 +187,7 @@
187187
(is (info/extract-arglists (info/info {:ns "clojure.core" :symbol "."})))
188188
(is (not (info/extract-arglists (info/info {:ns "clojure.core" :symbol (gensym "non-existing")})))))
189189

190-
(deftest test-var-meta
190+
(deftest var-meta-test
191191
;; Test files can't be found on the class path.
192192
(is (:file (info/var-meta #'info/var-meta)))
193193
(is (re-find #"cider-nrepl" (:file (#'info/maybe-add-file {:ns (find-ns 'cider.nrepl.middleware.info)}))))
@@ -248,7 +248,7 @@
248248
`(if (not ~pred) ~a ~b))
249249

250250
(use-fixtures :each session/session-fixture)
251-
(deftest integration-tests
251+
(deftest integration-test
252252
(testing "info op"
253253
(testing "get info of a clojure function"
254254
(let [response (session/message {:op "info" :symbol "testing-function" :ns "cider.nrepl.middleware.info-test"})]
@@ -471,7 +471,7 @@
471471
(set (:eldoc response))))
472472
(is (= (:type response) "function"))))))
473473

474-
(deftest missing-info
474+
(deftest missing-info-test
475475
(testing "ensure info returns a no-info packet if symbol not found"
476476
(let [response (session/message {:op "info" :symbol "awoeijfxcvb" :ns "user"})]
477477
(is (= (:status response) #{"no-info" "done"}))))
@@ -488,7 +488,7 @@
488488
(let [response (session/message {:op "info" :class "java.lang.Exception" :member "fakefakefake"})]
489489
(is (= (:status response) #{"no-info" "done"})))))
490490

491-
(deftest missing-eldoc
491+
(deftest missing-eldoc-test
492492
(testing "ensure eldoc returns a no-eldoc packet if symbol not found"
493493
(let [response (session/message {:op "eldoc" :symbol "awoeijfxcvb" :ns "user"})]
494494
(is (= (:status response) #{"no-eldoc" "done"}))))
@@ -505,7 +505,7 @@
505505
(let [response (session/message {:op "eldoc" :class "java.lang.Exception" :member "fakefakefake"})]
506506
(is (= (:status response) #{"no-eldoc" "done"})))))
507507

508-
(deftest error-handling
508+
(deftest error-handling-test
509509
(testing "handle the exception thrown if no member provided to a java class info query"
510510
(let [response (session/message {:op "info" :class "test"})]
511511
(is (= (:status response) #{"info-error" "done"}))

0 commit comments

Comments
 (0)