summaryrefslogtreecommitdiff
path: root/lib/std/test
diff options
context:
space:
mode:
Diffstat (limited to 'lib/std/test')
-rw-r--r--lib/std/test/chartype.myr18
-rw-r--r--lib/std/test/fmt.myr4
-rw-r--r--lib/std/test/utf.myrbin0 -> 1305 bytes
3 files changed, 22 insertions, 0 deletions
diff --git a/lib/std/test/chartype.myr b/lib/std/test/chartype.myr
index d0df1d2..30426e6 100644
--- a/lib/std/test/chartype.myr
+++ b/lib/std/test/chartype.myr
@@ -20,4 +20,22 @@ const main = {
std.assert(!std.isalnum('!'), "! should not be isalnum\n")
std.assert(!std.isspace('@'), "@ should not be isspace\n")
std.assert(!std.isblank('@'), "@ should not be isblank\n")
+
+ std.assert(std.cellwidth(std.Badchar) == -1, "Badchar should have width -1\n")
+ std.assert(std.cellwidth((0 : char)) == 0, "U+0000 should have width 0\n")
+ std.assert(std.cellwidth('') == -1, "^E should have width -1\n")
+ std.assert(std.cellwidth('a') == 1, "'a' should have width 1\n")
+ std.assert(std.cellwidth('ê') == 1, "'ê' should have width 1\n")
+ std.assert(std.cellwidth('̀') == 0, "U+300 should have width 0\n")
+ std.assert(std.cellwidth('ϼ') == 1, "ϼ should have width 1\n")
+ std.assert(std.cellwidth('Ї') == 1, "Ї should have width 1\n")
+ std.assert(std.cellwidth('⊲') == 1, "⊲ should have width 1\n")
+ std.assert(std.cellwidth(' ') == 2, "U+3000 should have width 2\n")
+ std.assert(std.cellwidth('ギ') == 2, "ギ should have width 2\n")
+ std.assert(std.cellwidth('匌') == 2, "匌 should have width 2\n")
+ std.assert(std.cellwidth('­') == 0, "U+00AD should have width 0\n")
+ std.assert(std.cellwidth('ࠠ') == 0, "U+820 should have width 0\n")
+ std.assert(std.cellwidth('־') == 1, "U+5BE should have width 1\n")
+ std.assert(std.cellwidth('ֿ') == 0, "U+5BF should have width 0\n")
+ std.assert(std.cellwidth('׀') == 1, "U+5C0 should have width 1\n")
}
diff --git a/lib/std/test/fmt.myr b/lib/std/test/fmt.myr
index 5d0cfa8..c1a17ac 100644
--- a/lib/std/test/fmt.myr
+++ b/lib/std/test/fmt.myr
@@ -56,6 +56,10 @@ const builtins = {
check("\\n\\r\\xff", "{e}", "\n\r\xff")
check("{}barbaz", "{{}}bar{}", "baz")
check("{barbaz}", "{{bar{}}}", "baz")
+ check(" Tlön", "{w=10}", "Tlön")
+ check(" háček", "{w=10}", "háček")
+ check("_____即是多多即", "{w=15,p=_}", "即是多多即")
+ check(" τῶν ῾Ελλήνων", "{w=15}", "τῶν ῾Ελλήνων")
check("abcd", "{}", "abcd")
check("123", "{}", 123)
check("7b", "{x}", 123)
diff --git a/lib/std/test/utf.myr b/lib/std/test/utf.myr
new file mode 100644
index 0000000..4ac25d7
--- /dev/null
+++ b/lib/std/test/utf.myr
Binary files differ