From d2b04050c0a9a15e29e15cbf9c487db93d07c46e Mon Sep 17 00:00:00 2001 From: Tomas Heinrich Date: Tue, 9 Mar 2010 14:09:24 +0100 Subject: lineedit: invalid unicode characters are replaced with CONFIG_SUBST_WCHAR function old new delta read_key_ungets - 50 +50 lineedit_read_key 223 252 +29 Signed-off-by: Tomas Heinrich Signed-off-by: Denys Vlasenko --- testsuite/ash.tests | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100755 testsuite/ash.tests (limited to 'testsuite/ash.tests') diff --git a/testsuite/ash.tests b/testsuite/ash.tests new file mode 100755 index 000000000..4b6efe42c --- /dev/null +++ b/testsuite/ash.tests @@ -0,0 +1,42 @@ +#!/bin/sh +# +# These are not ash tests, we use ash as a way to test lineedit! +# +# Copyright 2010 by Denys Vlasenko +# Licensed under GPL v2, see file LICENSE for details. + +. ./testing.sh + +# 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" \ + "\ +00000000 3f 2d 0a |?-.| +00000003 +" \ + "" \ + "echo \xff- | hexdump -C >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" \ + "\ +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" \ + +# 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" \ + "\ +00000000 3d 2d 0a |=-.| +00000003 +" \ + "" \ + "echo =+\xff\xff\x1b\x5b\x44- | hexdump -C >output; exit; exit; exit; exit\n" \ + +exit $FAILCOUNT -- cgit v1.2.3