3 # These are not ash tests, we use ash as a way to test lineedit!
5 # Copyright 2010 by Denys Vlasenko
6 # Licensed under GPL v2, see file LICENSE for details.
10 # testing "test name" "options" "expected result" "file input" "stdin"
12 testing "One byte which is not valid unicode char followed by valid input" \
13 "script -q -c 'ash' /dev/null >/dev/null; cat ash.output" \
15 00000000 3f 2d 0a |?-.|
19 "echo \xff- | hexdump -C >ash.output; exit; exit; exit; exit\n"
21 testing "30 bytes which are not valid unicode chars followed by valid input" \
22 "script -q -c 'ash' /dev/null >/dev/null; cat ash.output" \
24 00000000 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f |????????????????|
25 00000010 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 2d 0a |??????????????-.|
29 "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"
31 # Not sure this behavior is perfect: we lose all invalid input which precedes
32 # arrow keys and such. In this example, \xff\xff are lost
33 testing "2 bytes which are not valid unicode chars followed by left arrow key" \
34 "script -q -c 'ash' /dev/null >/dev/null; cat ash.output" \
36 00000000 3d 2d 0a |=-.|
40 "echo =+\xff\xff\x1b\x5b\x44- | hexdump -C >ash.output; exit; exit; exit; exit\n"
42 # ash should see "echo \xff\n",pause -> execute it as "echo ?" (which is
43 # not checked by the test), then read and execute the rest: "echo A | ..."
44 # The bug was that ash was eating the beginning of "echo A" despite the pause.
45 testing "Invalid unicode chars followed by a pause do not eat next chars" \
46 "{ echo -ne 'echo \xff\n'; sleep 1; echo -ne 'echo A | hexdump -C >ash.output; exit; exit; exit; exit\n'; } \
47 | script -q -c 'ash' /dev/null >/dev/null; cat ash.output" \