Sha256: 32b876048db8a942457332a637c63005e888413381de44521e3f63c7f6ba2da5

Contents?: true

Size: 1.27 KB

Versions: 2

Compression:

Stored size: 1.27 KB

Contents

(import [join split] "../src/string")
(import [list] "../src/sequence")
(import [str =] "../src/runtime")

(.log console "test join")

(assert (= "" (join nil)))
(assert (= "" (join "-" nil)))

(assert (= "" (join "")))
(assert (= "" (join "-" "")))
(assert (= "h" (join "-" "h")))
(assert (= "hello" (join "hello")))
(assert (= "h-e-l-l-o" (join "-" "hello")))

(assert (= "" (join [])))
(assert (= "" (join "-" [])))
(assert (= "1" (join "-" [1])))
(assert (= "1-2-3" (join "-" [1 2 3])))

(assert (= "" (join '())))
(assert (= "" (join "-" '())))
(assert (= "1" (join "-" '(1))))
(assert (= "1-2-3" (join "-" '(1 2 3))))

(assert (= "" (join {})))
(assert (= (str [:a 1]) (join {:a 1})))
(assert (= (str [:a 1]) (join "," {:a 1})))
(assert (= (str [:a 1] [:b 2]) (join {:a 1 :b 2})))
(assert (= (str [:a 1] "," [:b 2]) (join "," {:a 1 :b 2})))

(.log console "test split")

(assert (= [""] (split "" #"\s")))
(assert (= ["hello"] (split "hello" #"world")))
(assert (= ["q" "w" "e" "r" "t" "y" "u" "i" "o" "p"]
           (split "q1w2e3r4t5y6u7i8o9p" #"\d+")))

(assert (= ["q" "w" "e" "r" "t"]
           ; TODO: In clojure => ["q" "w" "e" "r" "t5y6u7i8o9p0"]
           (split "q1w2e3r4t5y6u7i8o9p0" #"\d+" 5)))

(assert (= ["Some" "words" "to" "split"]
           (split "Some words to split" " ")))

Version data entries

2 entries across 1 versions & 1 rubygems

Version Path
ruby-wisp-source-0.7.0 vendor/node_modules/wisp/test/string.wisp
ruby-wisp-source-0.7.0 vendor/try/node_modules/~wisp/test/string.wisp