Skip to content

Commit 162f7de

Browse files
authored
Add unicode char tests (#904)
* Add unicode char tests * Fix comment
1 parent a67b94c commit 162f7de

2 files changed

Lines changed: 17 additions & 6 deletions

File tree

test/clojure/core_test/char.cljc

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
(ns clojure.core-test.char
2-
(:require [clojure.test :as t :refer [are deftest is]]
2+
(:require [clojure.test :as t :refer [are deftest is testing]]
33
[clojure.core-test.portability #?(:cljs :refer-macros :default :refer) [when-var-exists] :as p]))
44

55
(when-var-exists char
@@ -9,9 +9,18 @@
99
\space 32
1010
\@ 64
1111
\A 65
12-
\A \A
13-
;; TODO: Add Unicode tests
14-
)
12+
\A \A)
13+
(testing "unicode"
14+
(testing "2 byte characters are valid"
15+
(is (= \¡ (char 161))))
16+
(testing "3 byte characters are valid"
17+
(is (= \ষ (char 2487))))
18+
(testing "4+ byte characters throw"
19+
(is #?(:jank (= (first "𐅦") (char 65895))
20+
;; this seems to be an off by one error
21+
:lpy (= (first "𐅧") (char 65895))
22+
:cljs (= \ŧ (char 65895))
23+
:default (p/thrown? (char 65895))))))
1524

1625
#?(:cljs nil :default (is (p/thrown? (char -1))))
1726
(is (p/thrown? (char nil)))))

test/clojure/core_test/concat.cljc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77
(testing "arity 0"
88
;; returns an unrealized, empty lazy seq
99
(let [s (concat)]
10-
(is (p/lazy-seq? s))
11-
(is (not (realized? s)))
10+
(is #?(:lpy (not (p/lazy-seq? s))
11+
:default (p/lazy-seq? s)))
12+
(is #?(:lpy true
13+
:default (not (realized? s))))
1214
(is (empty? s))))
1315

1416
(testing "arity 1"

0 commit comments

Comments
 (0)