Skip to content

Commit

Permalink
Restricted iterator tests to JVM
Browse files Browse the repository at this point in the history
  • Loading branch information
Paula Gearon committed Nov 27, 2023
1 parent 54e5625 commit 33d5932
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions test/tiara/data_test.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,21 @@
(is (= (seq (apply array-map (make-kv-range 20)))
(seq (apply ordered-map (make-kv-range 20)))))))

(defn- drain-iterable
"Similar to iterator-seq, without chunking"
[i]
(let [^java.util.Iterator it (.iterator ^Iterable i)]
(loop [v []]
(if (.hasNext it)
(recur (conj v (.next it)))
v))))

(deftest test-iterable
(testing "Testing the iterable interface"
(is (= [] (drain-iterable (ordered-map))))
(is (= [[:a 1] [:b 2]] (drain-iterable (ordered-map :a 1 :b 2))))))
#?(:clj
(defn- drain-iterable
"Similar to iterator-seq, without chunking"
[i]
(let [^java.util.Iterator it (.iterator ^Iterable i)]
(loop [v []]
(if (.hasNext it)
(recur (conj v (.next it)))
v)))))

#?(:clj
(deftest test-iterable
(testing "Testing the iterable interface"
(is (= [] (drain-iterable (ordered-map))))
(is (= [[:a 1] [:b 2]] (drain-iterable (ordered-map :a 1 :b 2)))))))

(deftest test-assoc
(testing "equivalence of maps constructed using assoc"
Expand Down

0 comments on commit 33d5932

Please sign in to comment.