Skip to content

Commit

Permalink
Clean up new clj-kondo warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
emlyn committed Feb 10, 2025
1 parent 0264471 commit a4c9414
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 22 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@ pom.xml.asc
/checkouts/
/node_modules
.eastwood
.clj-kondo/
.lein-deps-sum
.lein-repl-history
.lein-plugins/
.lein-failures
.nrepl-port
.java-version
.lsp/
.rebel_readline_history
.DS_Store
.#*
2 changes: 1 addition & 1 deletion src/same/platform.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

(def max-value
"The largest representable non-infinite Double."
#?(:clj (Double/MAX_VALUE)
#?(:clj Double/MAX_VALUE
:cljs (.-MAX_VALUE js/Number)))

(defn is-array?
Expand Down
27 changes: 14 additions & 13 deletions test/same/core_test.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
[same.core :refer [ish? zeroish? not-zeroish? set-comparator! with-comparator]]
[same.ish :as ish]
[same.platform :as p]
[same.test-helpers :refer [about infinity #?@(:clj [java-map java-set])]]))
[same.test-helpers :refer [about infinity]])
#?(:clj (:import [java.util HashSet HashMap])))

(deftest scalar-test
(is (ish? 1.0 1.0))
Expand Down Expand Up @@ -64,12 +65,12 @@
(is (not (ish? #{1.0 2 \b "c" :d} #{1.01 2 \b "c" :d}))))
#?(:clj
(testing "Java sets"
(is (ish? (java-set 1.0 2 \b "c" :d)
(java-set 1.0 2 \b "c" :d)))
(is (ish? (java-set 1.0 2 \b "c" :d)
(java-set (about 1) 2 \b "c" :d)))
(is (not (ish? (java-set 1.0 2 \b "c" :d)
(java-set 1.01 2 \b "c" :d)))))))
(is (ish? (HashSet. [1.0 2 \b "c" :d])
(HashSet. [1.0 2 \b "c" :d])))
(is (ish? (HashSet. [1.0 2 \b "c" :d])
(HashSet. [(about 1) 2 \b "c" :d])))
(is (not (ish? (HashSet. [1.0 2 \b "c" :d])
(HashSet. [1.01 2 \b "c" :d])))))))

(deftest map-test
(testing "Maps of keyword-double"
Expand All @@ -86,12 +87,12 @@
(is (not (ish? {1.0 2 :a "b"} {1.01 2 :a "b"}))))
#?(:clj
(testing "Java maps"
(is (ish? (java-map 1.0 2 :a "b")
(java-map 1.0 2 :a "b")))
(is (ish? (java-map 1.0 2 :a "b")
(java-map (about 1) 2 :a "b")))
(is (not (ish? (java-map 1.0 2 :a "b")
(java-map 1.01 2 :a "b")))))))
(is (ish? (HashMap. {1.0 2 :a "b"})
(HashMap. {1.0 2 :a "b"})))
(is (ish? (HashMap. {1.0 2 :a "b"})
(HashMap. {(about 1) 2 :a "b"})))
(is (not (ish? (HashMap. {1.0 2 :a "b"})
(HashMap. {1.01 2 :a "b"})))))))

(deftest array-test
(testing "Arrays of doubles"
Expand Down
8 changes: 0 additions & 8 deletions test/same/test_helpers.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,3 @@
(def nan
#?(:clj Double/NaN
:cljs js/NaN))

(defn java-set
[& coll]
(java.util.HashSet. ^java.util.Collection coll))

(defn java-map
[& {:as map}]
(java.util.HashMap. ^java.util.Map map))

0 comments on commit a4c9414

Please sign in to comment.