From df303ae11731b07f63b7034a7c141931d7a6fcbb Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sun, 2 Oct 2016 18:32:52 +0200 Subject: sh testsuite: sync ash-redir/ and hush-redir/ Signed-off-by: Denys Vlasenko --- shell/ash_test/ash-redir/redir_escapednum.right | 1 + shell/ash_test/ash-redir/redir_escapednum.tests | 2 + shell/ash_test/ash-redir/redir_expand.right | 18 ++++++ shell/ash_test/ash-redir/redir_expand.tests | 85 +++++++++++++++++++++++++ shell/ash_test/ash-redir/redir_multi.right | 4 ++ shell/ash_test/ash-redir/redir_multi.tests | 5 ++ 6 files changed, 115 insertions(+) create mode 100644 shell/ash_test/ash-redir/redir_escapednum.right create mode 100755 shell/ash_test/ash-redir/redir_escapednum.tests create mode 100644 shell/ash_test/ash-redir/redir_expand.right create mode 100755 shell/ash_test/ash-redir/redir_expand.tests create mode 100644 shell/ash_test/ash-redir/redir_multi.right create mode 100755 shell/ash_test/ash-redir/redir_multi.tests (limited to 'shell/ash_test') diff --git a/shell/ash_test/ash-redir/redir_escapednum.right b/shell/ash_test/ash-redir/redir_escapednum.right new file mode 100644 index 0000000..7326d96 --- /dev/null +++ b/shell/ash_test/ash-redir/redir_escapednum.right @@ -0,0 +1 @@ +Ok diff --git a/shell/ash_test/ash-redir/redir_escapednum.tests b/shell/ash_test/ash-redir/redir_escapednum.tests new file mode 100755 index 0000000..81983ca --- /dev/null +++ b/shell/ash_test/ash-redir/redir_escapednum.tests @@ -0,0 +1,2 @@ +echo NOT SHOWN \2>/dev/null +echo Ok diff --git a/shell/ash_test/ash-redir/redir_expand.right b/shell/ash_test/ash-redir/redir_expand.right new file mode 100644 index 0000000..ead25f6 --- /dev/null +++ b/shell/ash_test/ash-redir/redir_expand.right @@ -0,0 +1,18 @@ +shell_test +\shell_test +\shell_test +\shell_test +Here1 +Ok1 +Here2 +Ok2 +Here3 +Ok3 +Here4 +Ok4 +Now with variable refs +shell_test_1 +\shell_test_1 +\shell_test_1 +\shell_test_1 +Done diff --git a/shell/ash_test/ash-redir/redir_expand.tests b/shell/ash_test/ash-redir/redir_expand.tests new file mode 100755 index 0000000..c50b8ce --- /dev/null +++ b/shell/ash_test/ash-redir/redir_expand.tests @@ -0,0 +1,85 @@ +rm *shell_test* 2>/dev/null + +>\shell_test +echo *shell_test* +rm *shell_test* + +>\\shell_test +echo *shell_test* +rm *shell_test* + +>"\shell_test" +echo *shell_test* +rm *shell_test* + +>"\\shell_test" +echo *shell_test* +rm *shell_test* + + +cat <<\shell_test +Here1 +shell_test +echo Ok1 + +cat <<\\shell_test +Here2 +\shell_test +echo Ok2 + +cat <<"\shell_test" +Here3 +\shell_test +echo Ok3 + +cat <<"\\shell_test" +Here4 +\shell_test +echo Ok4 + + +echo Now with variable refs +i=1 + + +>\shell_test_$i +echo *shell_test* +rm *shell_test* + +>\\shell_test_$i +echo *shell_test* +rm *shell_test* + +>"\shell_test_$i" +echo *shell_test* +rm *shell_test* + +>"\\shell_test_$i" +echo *shell_test* +rm *shell_test* + +echo Done;exit +# UNFIXED BUG. bash apparently will expand $i even in terminating delimiter. +# http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html +# does not mandate this behavior. +# This is not likely to be used much in real-world. + +cat <<\shell_test_$i +Here1 +shell_test_$i +echo Ok1 + +cat <<\\shell_test_$i +Here2 +\shell_test_$i +echo Ok2 + +cat <<"\shell_test_$i" +Here3 +\shell_test_$i +echo Ok3 + +cat <<"\\shell_test_$i" +Here4 +\shell_test_$i +echo Ok4 diff --git a/shell/ash_test/ash-redir/redir_multi.right b/shell/ash_test/ash-redir/redir_multi.right new file mode 100644 index 0000000..a97c4bd --- /dev/null +++ b/shell/ash_test/ash-redir/redir_multi.right @@ -0,0 +1,4 @@ +Testing multiple redirections to same fd +Hello +Done1 +Done2 diff --git a/shell/ash_test/ash-redir/redir_multi.tests b/shell/ash_test/ash-redir/redir_multi.tests new file mode 100755 index 0000000..c639ebb --- /dev/null +++ b/shell/ash_test/ash-redir/redir_multi.tests @@ -0,0 +1,5 @@ +echo "Testing multiple redirections to same fd" +# bug was making us lose fd #1 after this: +echo Hello >/dev/null 1>&2 +echo Done1 +echo Done2 >&2 -- cgit v1.1