aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2017-08-22 14:03:45 -0700
committerRob Landley <rob@landley.net>2017-08-23 02:21:54 -0500
commit709a44246456a49c06d73dfbe84daa5b4ba5fec5 (patch)
treec561a059c45eeebbeac20fe3f6088384373d6c7b /tests
parent138915a0d75c9b8c8d5e0b0d168091277b68c350 (diff)
downloadtoybox-709a44246456a49c06d73dfbe84daa5b4ba5fec5.tar.gz
Fix iconv build and add trivial test.
Diffstat (limited to 'tests')
-rw-r--r--tests/iconv.test15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/iconv.test b/tests/iconv.test
new file mode 100644
index 00000000..8fe7c7a5
--- /dev/null
+++ b/tests/iconv.test
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+[ -f testing.sh ] && . testing.sh
+
+# Example characters from https://en.wikipedia.org/wiki/UTF-16:
+# $:U+0024 €:U+20ac 𐐷:U+10437[==U+d801,U+dc37]
+echo -n "$€𐐷" > chars
+
+#testing "name" "command" "result" "infile" "stdin"
+
+testing "" "iconv chars | xxd -p" "24e282acf09090b7\n" "" ""
+testing "-t UTF-16BE" "iconv -t utf16be chars | xxd -p" "002420acd801dc37\n" "" ""
+testing "-t UTF-16LE" "iconv -t utf16le chars | xxd -p" "2400ac2001d837dc\n" "" ""
+testing "-t UTF-32BE" "iconv -t utf32be chars | xxd -p" "00000024000020ac00010437\n" "" ""
+testing "-t UTF-32BE" "iconv -t utf32le chars | xxd -p" "24000000ac20000037040100\n" "" ""