summaryrefslogtreecommitdiff
path: root/lib/std/test
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2018-12-26 21:43:45 -0800
committerOri Bernstein <ori@eigenstate.org>2018-12-26 21:43:45 -0800
commit346140113cb979d60f27fb3795f08e5976c0c712 (patch)
treef86b1d17a69a7469f8c2f9bb1d6c3342b28d8103 /lib/std/test
parent3f5de2514eb4a90a8f7925bbeaf6dfdfb07debf8 (diff)
downloadmc-346140113cb979d60f27fb3795f08e5976c0c712.tar.gz
Implement `std.bygrapheme`.
Diffstat (limited to 'lib/std/test')
-rw-r--r--lib/std/test/striter.myr18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/std/test/striter.myr b/lib/std/test/striter.myr
index b54e580..0f93fb1 100644
--- a/lib/std/test/striter.myr
+++ b/lib/std/test/striter.myr
@@ -3,6 +3,18 @@ use std
const main = {
var chars = ['a', 'b', 'c']
var splits = ["foo", "+bar"]
+ var graphemes = [
+ [0x300][:],
+ [0x61][:],
+ [0x53f2][:],
+ [0x63][:],
+ [0x9][:],
+ [0x42f][:],
+ [0x78, 0x300, 0x300, 0x300, 0x300, 0x300][:],
+ [0xa][:],
+ [0x7a, 0x309][:]
+ ]
+
var i
i = 0
@@ -16,4 +28,10 @@ const main = {
std.assert(std.eq(splits[i++], sp), "wrong split {}", sp)
;;
std.assert(i == splits.len, "wrong split count")
+
+ i = 0
+ for g : std.bygrapheme("̀a史c\tЯx̀̀̀̀̀\nz̉")
+ std.assert(std.eq(g, graphemes[i++]), "mismatched grapheme cluster\n")
+ ;;
+ std.assert(i == graphemes.len, "wrong grapheme set length")
}