Skip to content

Commit 084d127

Browse files
authored
Cleanup: Fix core-test Deps Order, Remove Unused, etc. (#798)
* Cleanup * More cleanup * Fix cljr * Next round * More! * Remove superfluous paren * WIP * WIP * Fix more parens * More! * Whoops * Add back * clj the kondo * WIP * int * Next batch * Some more * WIP * Next round * Another round * 4 more * mooooooore * Trickier ones * Fix num * Next round * more more more! * Fix parse-double * Next one * Fix `parse-uuid` * Tricky ones * Fix `parse-long` * updates * Fix * Fix * Fix `unsigned-bit-shift-right` * Last batch * grammar * Add space * `is` before `testing` * Missed a whole batch * is before testing * Move common case to `:default` * Remove whitespace * Whoops * Some more cleanup * Some more * Syntax! * Provide defaults * Cleanup * Fix syntax issue * Take 2
1 parent 495303e commit 084d127

File tree

193 files changed

+1334
-1336
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

193 files changed

+1334
-1336
lines changed

.clj-kondo/config.edn

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{:linters {:inline-def {:level :off}
2+
:invalid-arity {:level :off}
3+
:missing-body-in-when {:level :off}
4+
:single-logical-operand {:level :off}
5+
:type-mismatch {:level :off}
6+
:unresolved-symbol {:level :off}
7+
:uninitialized-var {:level :off}
8+
:unused-namespace {:level :off}
9+
:unused-referred-var {:level :off}
10+
:unused-value {:level :off}}
11+
:lint-as {clojure.core-test.portability/when-var-exists clojure.core/when}}

.gitignore

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ pom.xml.asc
1111
/.prepl-port
1212
.hgignore
1313
.hg/
14-
/.clj-kondo
15-
/.lsp
14+
/.clj-kondo/*
15+
!/.clj-kondo/config.edn
16+
/.lsp/*
17+
!/.lsp/config.edn
1618
*~
1719
.*.swp
1820
/node_modules

.lsp/config.edn

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{:linters {:clojure-lsp/unused-public-var {:level :off}}}

templates/test-template.cljc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
(ns {{base-ns}}-test.{{ns-suffix}}
22
(:require {% if not base-ns = "clojure.core" %}{{base-ns}}
3-
{% endif %}[clojure.test :as t :refer [deftest testing is are]]
3+
{% endif %}[clojure.test :as t :refer [are deftest is testing]]
44
[clojure.core-test.portability #?(:cljs :refer-macros :default :refer) [when-var-exists]]))
55

66
(when-var-exists {% if not base-ns = "clojure.core" %}{{base-ns}}/{% endif %}{{sym-name}}

test/clojure/core_test/abs.cljc

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,32 @@
11
(ns clojure.core-test.abs
2-
(:require [clojure.test :as t :refer [deftest testing is are]]
2+
(:require [clojure.test :as t :refer [are deftest is testing]]
33
[clojure.core-test.number-range :as r]
4-
[clojure.core-test.portability #?(:cljs :refer-macros :default :refer) [when-var-exists]]))
4+
[clojure.core-test.portability #?(:cljs :refer-macros :default :refer) [when-var-exists]]))
55

6-
(when-var-exists clojure.core/abs
6+
(when-var-exists abs
77
(deftest test-abs
88
(testing "common"
99
(are [in ex] (= ex (abs in))
10-
-1 1
11-
1 1
12-
(inc r/min-int) (- (inc r/min-int))
13-
#?@(:clj [r/min-int r/min-int]) ; fixed int 2's complement oddity, see below for :cljr
14-
-1.0 1.0
15-
-0.0 0.0
16-
##-Inf ##Inf
17-
##Inf ##Inf
18-
-123.456M 123.456M
19-
-123N 123N
10+
-1 1
11+
1 1
12+
(inc r/min-int) (- (inc r/min-int))
13+
-1.0 1.0
14+
-0.0 0.0
15+
##-Inf ##Inf
16+
##Inf ##Inf
17+
-123.456M 123.456M
18+
-123N 123N
19+
20+
#?@(:cljr []
21+
:clj [r/min-int r/min-int] ; fixed int 2's complement oddity, see below for :cljr
22+
:default [r/min-int (* -1 r/min-int)])
2023
#?@(:cljs []
2124
:default
22-
[-1/5 1/5]))
25+
[-1/5 1/5]))
2326
(is (NaN? (abs ##NaN)))
24-
#?(:cljr (is (thrown? System.OverflowException (abs r/min-int))))
27+
#?(:cljr (is (thrown? System.OverflowException (abs r/min-int))))
2528
#?(:cljs (is (zero? (abs nil)))
26-
:default (is (thrown? #?(:clj Exception :cljr Exception) (abs nil)))))
29+
:default (is (thrown? Exception (abs nil)))))
2730

2831
(testing "unboxed"
2932
(let [a 42

test/clojure/core_test/aclone.cljc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
(ns clojure.core-test.aclone
2-
(:require [clojure.test :as t :refer [deftest testing is are]]
3-
[clojure.core-test.portability #?(:cljs :refer-macros :default :refer) [when-var-exists]]))
2+
(:require [clojure.test :as t :refer [deftest is testing]]
3+
[clojure.core-test.portability #?(:cljs :refer-macros :default :refer) [when-var-exists]]))
44

5-
(when-var-exists clojure.core/aclone
5+
(when-var-exists aclone
66
(defn clone-test
77
[a b]
88
(aset a 0 1)

test/clojure/core_test/add_watch.cljc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
(ns clojure.core-test.add-watch
2-
(:require [clojure.test :as t :refer [deftest testing is are]]
3-
[clojure.core-test.portability #?(:cljs :refer-macros :default :refer) [when-var-exists sleep]]))
2+
(:require [clojure.test :as t :refer [deftest is testing]]
3+
[clojure.core-test.portability #?(:cljs :refer-macros :default :refer) [when-var-exists sleep]]))
44

5-
(when-var-exists clojure.core/add-watch
5+
(when-var-exists add-watch
66
(deftest test-add-watch
77
(testing "watch atom"
88
;; checks atoms and interspersed multiple watches
@@ -156,7 +156,7 @@
156156
(catch #?(:cljs :default
157157
:clj clojure.lang.ExceptionInfo
158158
:cljr clojure.lang.ExceptionInfo) e
159-
(let [{:keys [old] :as data} (ex-data e)]
159+
(let [{:keys [_old] :as data} (ex-data e)]
160160
(vswap! state conj data)))))
161161
keyed (fn [k s] (filter #(= k (:key %)) s))]
162162

@@ -216,14 +216,14 @@
216216
:default
217217
[(testing "watch agent"
218218
(let [state (volatile! [])
219-
tester1 (fn [key ref old new]
219+
tester1 (fn [key _ref old new]
220220
(when (not= old new)
221221
(vswap! state conj {:key key :old old :new new :tester 1})))
222-
tester2 (fn [key ref old new]
222+
tester2 (fn [key _ref old new]
223223
(when (not= old new)
224224
(vswap! state conj {:key key :old old :new new :tester 2})))
225225
agent-end (promise)
226-
err (fn [key ref old new]
226+
err (fn [key _ref old new]
227227
(deliver agent-end :done)
228228
(throw (ex-info "test" {:key key :old old :new new :tester :err})))
229229
g (agent 20)
@@ -232,7 +232,7 @@
232232
(vswap! state conj (ex-data e))
233233
(restart-agent g :ready))
234234
(send g inc))
235-
keyed (fn [k s] (set (filter #(= k (:key %)) s)))]
235+
_keyed (fn [k s] (set (filter #(= k (:key %)) s)))]
236236

237237
;; add a watch to the agent
238238
(is (= g (add-watch g :g tester1)))

test/clojure/core_test/and.cljc

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
(ns clojure.core-test.and
2-
(:require [clojure.test :as t :refer [deftest testing is are]]
3-
[clojure.core-test.portability #?(:cljs :refer-macros :default :refer) [when-var-exists]]))
2+
(:require [clojure.test :as t :refer [are deftest is testing]]
3+
[clojure.core-test.portability #?(:cljs :refer-macros :default :refer) [when-var-exists]]))
44

5-
(when-var-exists clojure.core/and
5+
(when-var-exists and
66
(deftest test-and
77
(testing "common"
88
(is (= true (and)))
9-
(are [x] (= x (and x))
9+
(are [x] (= x
10+
(and x))
1011
true
1112
false
1213
nil
@@ -33,4 +34,5 @@
3334
(is (= nil (and nil nil nil nil nil nil nil nil nil nil nil nil true)))))
3435

3536
(testing "infinite-sequence"
36-
(is (some? (and (range)))))))
37+
(is (some?
38+
(and (range)))))))

test/clojure/core_test/any_qmark.cljc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
(ns clojure.core-test.any-qmark
2-
(:require [clojure.test :as t :refer [deftest testing is are]]
3-
[clojure.core-test.portability #?(:cljs :refer-macros :default :refer) [when-var-exists]]))
2+
(:require [clojure.test :as t :refer [are deftest is testing]]
3+
[clojure.core-test.portability #?(:cljs :refer-macros :default :refer) [when-var-exists]]))
44

5-
(when-var-exists clojure.core/any?
5+
(when-var-exists any?
66
(deftest test-any?
77
(testing "common"
88
(are [x] (= true (any? x))

test/clojure/core_test/assoc.cljc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
(ns clojure.core-test.assoc
2-
(:require [clojure.test :refer [deftest testing is are]]
2+
(:require [clojure.test :refer [are deftest is testing]]
33
[clojure.core-test.portability #?(:cljs :refer-macros :default :refer) [when-var-exists]]))
44

55
(when-var-exists assoc

0 commit comments

Comments
 (0)