File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change 1+ (ns clojure.core-test.rseq
2+ (:require [clojure.test :as t :refer [deftest testing is are]]
3+ [clojure.core-test.portability #?(:cljs :refer-macros :default :refer ) [when-var-exists ]]))
4+
5+ (when-var-exists rseq
6+ (deftest test-rseq
7+ (testing " common"
8+ (is (= nil (rseq [])))
9+ (is (= '(3 2 1 ) (rseq [1 2 3 ])))
10+ (is (= '(:c :b :a ) (rseq [:a :b :c ])))
11+ (is (= '(\c \b \a) (rseq [\a \b \c])))
12+ (is (= '(4 3 [1 2 ]) (rseq [[1 2 ] 3 4 ])))
13+ #?@(:cljs [(is (thrown? js/Error (rseq nil )))
14+ (is (thrown? js/Error (rseq " " )))
15+ (is (thrown? js/Error (rseq :a )))
16+ (is (thrown? js/Error (rseq 0 )))
17+ (is (thrown? js/Error (rseq 0.0 )))
18+ (is (thrown? js/Error (rseq {:a :b })))]
19+ :default [(is (thrown? Exception (rseq nil )))
20+ (is (thrown? Exception (rseq " " )))
21+ (is (thrown? Exception (rseq \space)))
22+ (is (thrown? Exception (rseq :a )))
23+ (is (thrown? Exception (rseq 0 )))
24+ (is (thrown? Exception (rseq 0.0 )))
25+ (is (thrown? Exception (rseq {:a :b })))]))
26+
27+ (when-var-exists clojure.core/sorted-map
28+ (testing " sorted-map"
29+ (is (= '([:c 2 ] [:b 1 ] [:a 0 ]) (rseq (sorted-map :a 0 , :b 1 , :c 2 ))))))))
You can’t perform that action at this time.
0 commit comments