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 2328
2328
assoc :tag 'array)))
2329
2329
2330
2330
(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)))
2337
2339
2338
2340
(core/defmacro list
2339
2341
([] '(.-EMPTY cljs.core/List))
Original file line number Diff line number Diff line change 1044
1044
(apply aset a [0 0 " bar" ])
1045
1045
(is (= (aget a 0 0 ) " bar" ))))))
1046
1046
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
+
1047
1066
(deftest test-rearrange-sequential
1048
1067
(testing " Test rearranging sequential collections"
1049
1068
(is (= [1 2 3 4 5 ] (sort [5 3 1 4 2 ])))
You can’t perform that action at this time.
0 commit comments