aboutsummaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite')
-rwxr-xr-xtestsuite/ash.tests26
1 files changed, 20 insertions, 6 deletions
diff --git a/testsuite/ash.tests b/testsuite/ash.tests
index 4b6efe42c..6b2caf316 100755
--- a/testsuite/ash.tests
+++ b/testsuite/ash.tests
@@ -10,33 +10,47 @@
# testing "test name" "options" "expected result" "file input" "stdin"
testing "One byte which is not valid unicode char followed by valid input" \
- "script -q -c 'ash' /dev/null >/dev/null; cat output; rm output" \
+ "script -q -c 'ash' /dev/null >/dev/null; cat ash.output" \
"\
00000000 3f 2d 0a |?-.|
00000003
" \
"" \
- "echo \xff- | hexdump -C >output; exit; exit; exit; exit\n" \
+ "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 output; rm output" \
+ "script -q -c 'ash' /dev/null >/dev/null; cat ash.output" \
"\
00000000 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f |????????????????|
00000010 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 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 >output; exit; exit; exit; exit\n" \
+ "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"
# Not sure this behavior is perfect: we lose all invalid input which precedes
# arrow keys and such. In this example, \xff\xff are lost
testing "2 bytes which are not valid unicode chars followed by left arrow key" \
- "script -q -c 'ash' /dev/null >/dev/null; cat output; rm output" \
+ "script -q -c 'ash' /dev/null >/dev/null; cat ash.output" \
"\
00000000 3d 2d 0a |=-.|
00000003
" \
"" \
- "echo =+\xff\xff\x1b\x5b\x44- | hexdump -C >output; exit; exit; exit; exit\n" \
+ "echo =+\xff\xff\x1b\x5b\x44- | hexdump -C >ash.output; exit; exit; exit; exit\n"
+
+# ash should see "echo \xff\n",pause -> execute it as "echo ?" (which is
+# not checked by the test), then read and execute the rest: "echo A | ..."
+# The bug was that ash was eating the beginning of "echo A" despite the pause.
+testing "Invalid unicode chars followed by a pause do not eat next chars" \
+ "{ echo -ne 'echo \xff\n'; sleep 1; echo -ne 'echo A | hexdump -C >ash.output; exit; exit; exit; exit\n'; } \
+ | script -q -c 'ash' /dev/null >/dev/null; cat ash.output" \
+ "\
+00000000 41 0a |A.|
+00000002
+" \
+ "" ""
+
+rm ash.output
exit $FAILCOUNT