aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2020-12-05 17:41:39 -0800
committerRob Landley <rob@landley.net>2020-12-06 02:24:12 -0600
commited3d5eb0eaf74e6686bc2576b2c4d5a5343dfd57 (patch)
treee0116710fb056cee84f021d8b2c230806679b65b /tests
parent49c02dbe435681015a88c636749d144044fc5e4a (diff)
downloadtoybox-ed3d5eb0eaf74e6686bc2576b2c4d5a5343dfd57.tar.gz
unicode: new toy.
Based loosely on the Plan9/Inferno utility, and a convenient way to go back and forth between code points and utf8 sequences. This patch also fixes a couple of bugs in wctoutf8 (and the tests for this toy effectively serve as unit tests for wctoutf8/utf8towc).
Diffstat (limited to 'tests')
-rwxr-xr-xtests/unicode.test13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/unicode.test b/tests/unicode.test
new file mode 100755
index 00000000..099231d2
--- /dev/null
+++ b/tests/unicode.test
@@ -0,0 +1,13 @@
+#!/bin/bash
+
+[ -f testing.sh ] && . testing.sh
+
+#testing "name" "command" "result" "infile" "stdin"
+
+testing "text" "unicode 안녕 hi" "U+C548 : 안 : 0xec 0x95 0x88\nU+B155 : 녕 : 0xeb 0x85 0x95\nU+0068 : h\nU+0069 : i\n" "" ""
+testing "code points" "unicode 70 666" "U+0070 : p\nU+0666 : ٦ : 0xd9 0xa6\n" "" ""
+testing "ASCII controls" "unicode 0" "U+0000 : NUL\n" "" ""
+testing "del" "unicode 7f" "U+007F : DEL\n" "" ""
+testing "3-byte" "unicode 30b9" "U+30B9 : ス : 0xe3 0x82 0xb9\n" "" ""
+testing "4-byte" "unicode 10000" "U+10000 : 𐀀 : 0xf0 0x90 0x80 0x80\n" "" ""
+testing "range" "unicode 660-662" "U+0660 : ٠ : 0xd9 0xa0\nU+0661 : ١ : 0xd9 0xa1\nU+0662 : ٢ : 0xd9 0xa2\n" "" ""