Skip to content

Commit 32328e3

Browse files
committed
* fix bug in str_
* add some simple tests
1 parent 48e82a6 commit 32328e3

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/main/cljs/cljs/core.cljs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3088,7 +3088,7 @@ reduces them without incurring seq initialization"
30883088
(let [sb (StringBuffer.)
30893089
args (js-arguments)
30903090
len (alength args)]
3091-
(loop [i 1]
3091+
(loop [i 0]
30923092
(if (< i len)
30933093
(do
30943094
(.append sb (cljs.core/str_ (aget args i)))

src/test/cljs/cljs/core_test.cljs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2056,3 +2056,12 @@
20562056
[1 2 {:a 1, :b 2, :c 3}]))
20572057
(is (= (test-keys :d 4 {:a 1, :b 2, :c 3})
20582058
[1 2 {:d 4, :a 1, :b 2, :c 3}]))))
2059+
2060+
(deftest test-str_
2061+
(is (= "" (apply cljs.core/str_ nil)))
2062+
(is (= "" (apply cljs.core./str_ [])))
2063+
(is (= "1" (apply cljs.core/str_ 1 [])))
2064+
(is (= "12" (apply cljs.core/str_ 1 [2])))
2065+
(is (= "1two:threefour#{:five}[:six]#{:seven}{:eight :nine}"
2066+
(apply cljs.core/str_ 1 ["two" :three 'four #{:five} [:six] #{:seven} {:eight :nine}])))
2067+
(is (= "1234" (apply cljs.core/str_ 1 2 [3 4]))))

0 commit comments

Comments
 (0)