summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGravatar fab <fabrice.leal.ch@gmail.com>2018-12-06 21:24:04 +0000
committerGravatar fab <fabrice.leal.ch@gmail.com>2018-12-06 21:24:04 +0000
commitdf191c8374991f65c5f5a552cfa5f4fb08fe29e8 (patch)
tree42f8c1d6bae638bf47e2e012dff8feba30e74463 /tests
parentbc1547efbbad30da255b7c29973c94c8d37edabc (diff)
chars with more than 2 bytes are awkwardly handled by the "normal" string of javascript. the best way to get consistent results seems to be to convert to array by Array.from(...) and back to strings with .join("")
Diffstat (limited to 'tests')
-rw-r--r--tests/utf8.ur20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/utf8.ur b/tests/utf8.ur
index e7c7fd40..cf781fa9 100644
--- a/tests/utf8.ur
+++ b/tests/utf8.ur
@@ -31,6 +31,25 @@ fun test_fn_cside [a ::: Type] (_ : eq a) (_ : show a) (f : unit -> a) (expected
</active>
</xml>
+fun highencode () : transaction page =
+ return <xml>
+ <body>
+ {test_fn_cside (fn _ => strlen "𝌆𝌇𝌈𝌉") (strlen "𝌆𝌇𝌈𝌉") "high encode - strlen 1"}
+ {test_fn_cside (fn _ => strlen "𝌇𝌈𝌉") (strlen "𝌇𝌈𝌉") "high encode - strlen 2"}
+ {test_fn_cside (fn _ => strlen "𝌈𝌉") (strlen "𝌈𝌉") "high encode - strlen 3"}
+ {test_fn_cside (fn _ => strlen "𝌉") (strlen "𝌉") "high encode - strlen 4"}
+
+ {test_fn_cside (fn _ => substring "𝌆𝌇𝌈𝌉" 1 3) (substring "𝌆𝌇𝌈𝌉" 1 3) "high encode - substring 1"}
+ {test_fn_cside (fn _ => substring "𝌆𝌇𝌈𝌉" 2 2) (substring "𝌆𝌇𝌈𝌉" 2 2) "high encode - substring 2"}
+ {test_fn_cside (fn _ => substring "𝌆𝌇𝌈𝌉" 3 1) (substring "𝌆𝌇𝌈𝌉" 3 1) "high encode - substring 3"}
+
+ {test_fn_cside (fn _ => strlen (substring "𝌆𝌇𝌈𝌉" 1 3)) (strlen (substring "𝌆𝌇𝌈𝌉" 1 3)) "high encode - strlen of substring 1"}
+ {test_fn_cside (fn _ => strlen (substring "𝌆𝌇𝌈𝌉" 2 2)) (strlen (substring "𝌆𝌇𝌈𝌉" 2 2)) "high encode - strlen of substring 2"}
+ {test_fn_cside (fn _ => strlen (substring "𝌆𝌇𝌈𝌉" 3 1)) (strlen (substring "𝌆𝌇𝌈𝌉" 3 1)) "high encode - strlen of substring 3"}
+
+ </body>
+ </xml>
+
fun substrings () : transaction page =
return <xml>
<body>
@@ -510,6 +529,7 @@ fun index () : transaction page =
<a link={touppers ()}>touppers</a>
<a link={ord_and_chrs ()}>ord_and_chrs</a>
<a link={test_ords ()}>test ord</a>
+ <a link={highencode ()}>highencode</a>
<a link={test_db ()}>test_db</a>
</body>
</xml>