From 37f3e371563c513e419982839c562e90974c3320 Mon Sep 17 00:00:00 2001 From: schwarze Date: Mon, 5 Jun 2017 17:34:09 +0000 Subject: [PATCH] Test insertion of non-ASCII characters, in particular making sure that valid input does not cause writing invalid intermediate states to the terminal, and that invalid input is not delayed waiting for more input, but written through right away. Currently failing, but expected to be fixed shortly. --- regress/bin/ksh/edit/emacs.sh | 59 +++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/regress/bin/ksh/edit/emacs.sh b/regress/bin/ksh/edit/emacs.sh index 145f2c820a7..569a2138ec3 100644 --- a/regress/bin/ksh/edit/emacs.sh +++ b/regress/bin/ksh/edit/emacs.sh @@ -1,6 +1,7 @@ #!/bin/sh # # Copyright (c) 2017 Anton Lindqvist +# Copyright (c) 2017 Ingo Schwarze # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -29,3 +30,61 @@ export EDITOR ENV HISTFILE MAIL MALLOC_OPTIONS PS1 VISUAL # auto-insert testseq "abc" " $ abc" + +# insertion of valid UTF-8 +testseq "z\0002\0302\0200" " $ z\b\0302\0200z\b" +testseq "z\0002\0337\0277" " $ z\b\0337\0277z\b" +testseq "z\0002\0340\0240\0200" " $ z\b\0340\0240\0200z\b" +testseq "z\0002\0354\0277\0277" " $ z\b\0354\0277\0277z\b" +testseq "z\0002\0355\0200\0200" " $ z\b\0355\0200\0200z\b" +testseq "z\0002\0355\0237\0277" " $ z\b\0355\0237\0277z\b" +testseq "z\0002\0356\0200\0200" " $ z\b\0356\0200\0200z\b" +testseq "z\0002\0357\0277\0277" " $ z\b\0357\0277\0277z\b" +testseq "z\0002\0364\0200\0200\0200" " $ z\b\0364\0200\0200\0200z\b" +testseq "z\0002\0364\0217\0277\0277" " $ z\b\0364\0217\0277\0277z\b" + +# insertion of incomplete UTF-8 +testseq "z\0002\0302\0006" " $ z\b\0302z\bz" +testseq "z\0002\0377\0006" " $ z\b\0377z\bz" +testseq "z\0002\0337\0006" " $ z\b\0337z\bz" +testseq "z\0002\0340\0006" " $ z\b\0340z\bz" +testseq "z\0002\0357\0006" " $ z\b\0357z\bz" +testseq "z\0002\0364\0006" " $ z\b\0364z\bz" +testseq "z\0002\0340\0240\0006" " $ z\b\0340\0240z\bz" +testseq "z\0002\0354\0277\0006" " $ z\b\0354\0277z\bz" +testseq "z\0002\0355\0200\0006" " $ z\b\0355\0200z\bz" +testseq "z\0002\0355\0237\0006" " $ z\b\0355\0237z\bz" +testseq "z\0002\0356\0200\0006" " $ z\b\0356\0200z\bz" +testseq "z\0002\0357\0277\0006" " $ z\b\0357\0277z\bz" +testseq "z\0002\0364\0200\0200\0006" " $ z\b\0364\0200\0200z\bz" +testseq "z\0002\0364\0217\0277\0006" " $ z\b\0364\0217\0277z\bz" + +# insertion of invalid bytes +testseq "z\0002\0300\0277" " $ z\b\0300z\b\b\0300\0277z\b" +testseq "z\0002\0301\0277" " $ z\b\0301z\b\b\0301\0277z\b" +testseq "z\0002\0360\0217" " $ z\b\0360z\b\b\0360\0217z\b" +testseq "z\0002\0363\0217" " $ z\b\0363z\b\b\0363\0217z\b" +testseq "z\0002\0365\0217" " $ z\b\0365z\b\b\0365\0217z\b" +testseq "z\0002\0367\0217" " $ z\b\0367z\b\b\0367\0217z\b" +testseq "z\0002\0370\0217" " $ z\b\0370z\b\b\0370\0217z\b" +testseq "z\0002\0377\0217" " $ z\b\0377z\b\b\0377\0217z\b" + +# insertion of excessively long encodings +testseq "z\0002\0340\0200\0200" \ + " $ z\b\0340z\b\b\0340\0200z\b\b\0340\0200\0200z\b" +testseq "z\0002\0340\0201\0277" \ + " $ z\b\0340z\b\b\0340\0201z\b\b\0340\0201\0277z\b" +testseq "z\0002\0340\0202\0200" \ + " $ z\b\0340z\b\b\0340\0202z\b\b\0340\0202\0200z\b" +testseq "z\0002\0340\0237\0277" \ + " $ z\b\0340z\b\b\0340\0237z\b\b\0340\0237\0277z\b" + +# insertion of surrogates and execessive code points +testseq "z\0002\0355\0240\0200" \ + " $ z\b\0355z\b\b\0355\0240z\b\b\0355\0240\0200z\b" +testseq "z\0002\0355\0277\0277" \ + " $ z\b\0355z\b\b\0355\0277z\b\b\0355\0277\0277z\b" +testseq "z\0002\0364\0220\0200\0200" \ + " $ z\b\0364z\b\b\0364\0220z\b\b\0364\0220\0200z\b\b\0364\0220\0200\0200z\b" +testseq "z\0002\0364\0277\0277\0277" \ + " $ z\b\0364z\b\b\0364\0277z\b\b\0364\0277\0277z\b\b\0364\0277\0277\0277z\b" -- 2.20.1