File tree Expand file tree Collapse file tree 2 files changed +27
-6
lines changed
Expand file tree Collapse file tree 2 files changed +27
-6
lines changed Original file line number Diff line number Diff line change 23282328 assoc :tag 'array)))
23292329
23302330(core/defmacro make-array
2331- [size]
2332- (vary-meta
2333- (if (core/number? size)
2334- `(array ~@(take size (repeat nil )))
2335- `(js/Array. ~size))
2336- assoc :tag 'array))
2331+ ([size]
2332+ (vary-meta
2333+ (if (core/number? size)
2334+ `(array ~@(take size (repeat nil )))
2335+ `(js/Array. ~size))
2336+ assoc :tag 'array))
2337+ ([type size]
2338+ `(make-array ~size)))
23372339
23382340(core/defmacro list
23392341 ([] '(.-EMPTY cljs.core/List))
Original file line number Diff line number Diff line change 10441044 (apply aset a [0 0 " bar" ])
10451045 (is (= (aget a 0 0 ) " bar" ))))))
10461046
1047+ (defn- primitive-arrays-equal
1048+ [a b]
1049+ (= (js->clj a) (js->clj b)))
1050+
1051+ (deftest test-make-array
1052+ (testing " Testing make-array"
1053+ (is (primitive-arrays-equal #js [] (make-array 0 )))
1054+ (is (primitive-arrays-equal #js [] (apply make-array [0 ])))
1055+ (is (primitive-arrays-equal #js [nil ] (make-array 1 )))
1056+ (is (primitive-arrays-equal #js [nil ] (apply make-array [1 ])))
1057+ (is (primitive-arrays-equal #js [nil nil ] (make-array 2 )))
1058+ (is (primitive-arrays-equal #js [nil nil ] (apply make-array [2 ])))
1059+ (is (primitive-arrays-equal #js [] (make-array nil 0 )))
1060+ (is (primitive-arrays-equal #js [] (apply make-array [nil 0 ])))
1061+ (is (primitive-arrays-equal #js [nil ] (make-array nil 1 )))
1062+ (is (primitive-arrays-equal #js [nil ] (apply make-array [nil 1 ])))
1063+ (is (primitive-arrays-equal #js [nil nil ] (make-array nil 2 )))
1064+ (is (primitive-arrays-equal #js [nil nil ] (apply make-array [nil 2 ])))))
1065+
10471066(deftest test-rearrange-sequential
10481067 (testing " Test rearranging sequential collections"
10491068 (is (= [1 2 3 4 5 ] (sort [5 3 1 4 2 ])))
You can’t perform that action at this time.
0 commit comments