Skip to content

Commit 681a507

Browse files
committed
less opaque reporting from walk test, rename test
1 parent 474bfec commit 681a507

File tree

1 file changed

+23
-22
lines changed

1 file changed

+23
-22
lines changed

src/test/cljs/cljs/walk_test.cljs

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -51,28 +51,29 @@
5151
(defmethod get-comparator PersistentTreeSet
5252
[o] (get-comparator (.-tree-map o)))
5353

54-
(deftest walk
55-
"Checks that walk returns the correct result and type of collection"
56-
(let [colls ['(1 2 3)
57-
[1 2 3]
58-
#{1 2 3}
59-
(sorted-set-by > 1 2 3)
60-
{:a 1, :b 2, :c 3}
61-
(sorted-map-by > 1 10, 2 20, 3 30)
62-
(->Foo 1 2 3)
63-
(map->Foo {:a 1 :b 2 :c 3 :extra 4})]]
64-
(doseq [c colls]
65-
(let [walked (w/walk identity identity c)]
66-
(is (= c walked))
67-
;;(is (= (type c) (type walked)))
68-
(if (map? c)
69-
(is (= (w/walk #(update-in % [1] inc) #(reduce + (vals %)) c)
70-
(reduce + (map (comp inc val) c))))
71-
(is (= (w/walk inc #(reduce + %) c)
72-
(reduce + (map inc c)))))
73-
(when (or (instance? PersistentTreeMap c)
74-
(instance? PersistentTreeSet c))
75-
(is (= (get-comparator c) (get-comparator walked))))))))
54+
(deftest test-walk
55+
(testing "Test that walk returns the correct result\n"
56+
(let [colls ['(1 2 3)
57+
[1 2 3]
58+
#{1 2 3}
59+
(sorted-set-by > 1 2 3)
60+
{:a 1, :b 2, :c 3}
61+
(sorted-map-by > 1 10, 2 20, 3 30)
62+
(->Foo 1 2 3)
63+
(map->Foo {:a 1 :b 2 :c 3 :extra 4})]]
64+
(doseq [c colls]
65+
(testing (str "Walking ... " c)
66+
(let [walked (w/walk identity identity c)]
67+
(is (= c walked))
68+
;;(is (= (type c) (type walked)))
69+
(if (map? c)
70+
(is (= (w/walk #(update-in % [1] inc) #(reduce + (vals %)) c)
71+
(reduce + (map (comp inc val) c))))
72+
(is (= (w/walk inc #(reduce + %) c)
73+
(reduce + (map inc c)))))
74+
(when (or (instance? PersistentTreeMap c)
75+
(instance? PersistentTreeSet c))
76+
(is (= (get-comparator c) (get-comparator walked))))))))))
7677

7778
(deftest walk-mapentry
7879
"Checks that walk preserves the MapEntry type. See CLJS-2909."

0 commit comments

Comments
 (0)