summaryrefslogtreecommitdiff
path: root/testsuite/ash.tests
diff options
context:
space:
mode:
authorTomas Heinrich2010-04-29 13:43:39 +0200
committerDenys Vlasenko2010-04-29 13:43:39 +0200
commita659b81dfa435aa19130a8c7dd1bfe8fa9a22131 (patch)
tree6e42922ad325142290898143818bcd819f799c27 /testsuite/ash.tests
parent25b10d97e66a74d4e5a5571afb1b8369c31eefca (diff)
downloadbusybox-a659b81dfa435aa19130a8c7dd1bfe8fa9a22131.zip
busybox-a659b81dfa435aa19130a8c7dd1bfe8fa9a22131.tar.gz
libbb/lineedit: add support for preserving "broken" (non-unicode) chars
Signed-off-by: Tomas Heinrich <heinrich.tomas@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'testsuite/ash.tests')
-rwxr-xr-xtestsuite/ash.tests24
1 files changed, 24 insertions, 0 deletions
diff --git a/testsuite/ash.tests b/testsuite/ash.tests
index 6b2caf3..ce585be 100755
--- a/testsuite/ash.tests
+++ b/testsuite/ash.tests
@@ -7,8 +7,30 @@
. ./testing.sh
+test -f "$bindir/.config" && . "$bindir/.config"
+
# testing "test name" "options" "expected result" "file input" "stdin"
+if test x"$CONFIG_UNICODE_PRESERVE_BROKEN" = x"y"; then
+testing "One byte which is not valid unicode char followed by valid input" \
+ "script -q -c 'ash' /dev/null >/dev/null; cat ash.output" \
+ "\
+00000000 ff 2d 0a |.-.|
+00000003
+" \
+ "" \
+ "echo \xff- | hexdump -C >ash.output; exit; exit; exit; exit\n"
+
+testing "30 bytes which are not valid unicode chars followed by valid input" \
+ "script -q -c 'ash' /dev/null >/dev/null; cat ash.output" \
+ "\
+00000000 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
+00000010 ff ff ff ff ff ff ff ff ff ff ff ff ff ff 2d 0a |..............-.|
+00000020
+" \
+ "" \
+ "echo \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff- | hexdump -C >ash.output; exit; exit; exit; exit\n"
+else
testing "One byte which is not valid unicode char followed by valid input" \
"script -q -c 'ash' /dev/null >/dev/null; cat ash.output" \
"\
@@ -27,6 +49,8 @@ testing "30 bytes which are not valid unicode chars followed by valid input" \
" \
"" \
"echo \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff- | hexdump -C >ash.output; exit; exit; exit; exit\n"
+fi
+
# Not sure this behavior is perfect: we lose all invalid input which precedes
# arrow keys and such. In this example, \xff\xff are lost