Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion test/clojure/string_test/blank_qmark.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@
:default (is (p/thrown? (str/blank? (keyword "")))))
#?(:cljs (is (false? (str/blank? 1)))
:default (is (p/thrown? (str/blank? 1))))
#?(:lpy (is (true? (str/blank? \space)))
;; Phel reads `\space` as the single-space string " ", so `blank?` returns
;; true (it is whitespace) rather than throwing on a character type.
#?(:phel (is (true? (str/blank? \space)))
:lpy (is (true? (str/blank? \space)))
:cljs (do (is (true? (str/blank? \space)))
(is (false? (str/blank? \a))))
:default (is (p/thrown? (str/blank? \space))))
Expand Down
9 changes: 8 additions & 1 deletion test/clojure/string_test/capitalize.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@
(when-var-exists str/capitalize
(deftest test-capitalize
(is (p/thrown? (str/capitalize nil)))
#?(:cljr (do (is (p/thrown? (str/capitalize 1)))
;; Phel's string functions are strict: a non-string argument throws
;; rather than being coerced via `str`/`toString` (the JVM `:default`
;; behaviour). Documented divergence; matches the :cljs/:lpy/:cljr stance.
#?(:phel (do (is (p/thrown? (str/capitalize 1)))
(is (p/thrown? (str/capitalize 'Asdf)))
(is (p/thrown? (str/capitalize 'asDf/aSdf)))
(is (p/thrown? (str/capitalize :asDf/aSdf))))
:cljr (do (is (p/thrown? (str/capitalize 1)))
(is (p/thrown? (str/capitalize 'Asdf)))
(is (p/thrown? (str/capitalize 'asDf/aSdf)))
(is (p/thrown? (str/capitalize :asDf/aSdf))))
Expand Down
10 changes: 9 additions & 1 deletion test/clojure/string_test/ends_with_qmark.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,15 @@
#?(:cljs (is (false? (str/ends-with? "ab" 'b)))
:default (is (p/thrown? (str/ends-with? "ab" 'b))))

#?@(:cljr
;; Phel's string functions are strict: a non-string argument throws
;; rather than being coerced via `str`/`toString` (the JVM `:default`
;; behaviour). Documented divergence; matches the :cljs/:lpy/:cljr stance.
#?@(:phel
[(is (p/thrown? (str/ends-with? 'ab "b")))
(is (p/thrown? (str/ends-with? 'ab "a")))
(is (p/thrown? (str/ends-with? :ab "b")))
(is (p/thrown? (str/ends-with? :ab "b")))]
:cljr
[(is (p/thrown? (str/ends-with? 'ab "b")))
(is (p/thrown? (str/ends-with? 'ab "a")))
(is (p/thrown? (str/ends-with? :ab "b")))
Expand Down
12 changes: 11 additions & 1 deletion test/clojure/string_test/lower_case.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,17 @@
(let [s "ASDF"]
(is (= "asdf" (str/lower-case "ASDF")))
(is (= "ASDF" s) "original string mutated"))
#?(:cljr
;; Phel's string functions are strict: a non-string argument throws
;; rather than being coerced via `str`/`toString` (the JVM `:default`
;; behaviour). Documented divergence; matches the :cljs/:lpy/:cljr stance.
#?(:phel
(are [v] (p/thrown? (str/lower-case v))
:ASDF
:ASDF/ASDF
'ASDF
'ASDF/ASDF)

:cljr
(are [v] (p/thrown? (str/lower-case v))
:ASDF
:ASDF/ASDF
Expand Down
10 changes: 9 additions & 1 deletion test/clojure/string_test/starts_with_qmark.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,15 @@
(is (false? (str/starts-with? "a-test" "-")))
(is (false? (str/starts-with? "a-test" "t")))

#?@(:cljr
;; Phel's string functions are strict: a non-string argument throws
;; rather than being coerced via `str`/`toString` (the JVM `:default`
;; behaviour). Documented divergence; matches the :cljs/:lpy/:cljr stance.
#?@(:phel
[(is (p/thrown? (str/starts-with? 'ab ":a")))
(is (p/thrown? (str/starts-with? :ab ":a")))
(is (p/thrown? (str/starts-with? 'a/b ":a")))
(is (p/thrown? (str/starts-with? :a/b ":a")))]
:cljr
[(is (p/thrown? (str/starts-with? 'ab ":a")))
(is (p/thrown? (str/starts-with? :ab ":a")))
(is (p/thrown? (str/starts-with? 'a/b ":a")))
Expand Down
12 changes: 11 additions & 1 deletion test/clojure/string_test/upper_case.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,17 @@
(let [s "asdf"]
(is (= "ASDF" (str/upper-case "asdf")))
(is (= "asdf" s) "original string mutated"))
#?(:cljr
;; Phel's string functions are strict: a non-string argument throws
;; rather than being coerced via `str`/`toString` (the JVM `:default`
;; behaviour). Documented divergence; matches the :cljs/:lpy/:cljr stance.
#?(:phel
(are [v] (p/thrown? (str/upper-case v))
:asdf
:asdf/asdf
'asdf
'asdf/asdf)

:cljr
(are [v] (p/thrown? (str/upper-case v))
:asdf
:asdf/asdf
Expand Down
Loading