From ab876cd107fe6ca274f58bae3264396745d8e5f9 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Wed, 18 Jun 2008 16:29:32 +0000 Subject: hush: add testsuite for "no globbing in redirection" rule. simplify redirection habdling --- shell/hush_test/hush-glob/glob_redir.right | 2 ++ shell/hush_test/hush-glob/glob_redir.tests | 9 +++++++++ shell/hush_test/hush-parsing/escape3.right | 23 +++++++++++++++++++++++ shell/hush_test/hush-parsing/escape3.tests | 8 ++++++++ shell/hush_test/hush-parsing/redir_space.right | 3 +++ shell/hush_test/hush-parsing/redir_space.tests | 6 ++++++ 6 files changed, 51 insertions(+) create mode 100644 shell/hush_test/hush-glob/glob_redir.right create mode 100755 shell/hush_test/hush-glob/glob_redir.tests create mode 100644 shell/hush_test/hush-parsing/escape3.right create mode 100755 shell/hush_test/hush-parsing/escape3.tests create mode 100644 shell/hush_test/hush-parsing/redir_space.right create mode 100755 shell/hush_test/hush-parsing/redir_space.tests (limited to 'shell/hush_test') diff --git a/shell/hush_test/hush-glob/glob_redir.right b/shell/hush_test/hush-glob/glob_redir.right new file mode 100644 index 000000000..fbd0309b0 --- /dev/null +++ b/shell/hush_test/hush-glob/glob_redir.right @@ -0,0 +1,2 @@ +z.tmp: +?.tmp: TEST diff --git a/shell/hush_test/hush-glob/glob_redir.tests b/shell/hush_test/hush-glob/glob_redir.tests new file mode 100755 index 000000000..621d12017 --- /dev/null +++ b/shell/hush_test/hush-glob/glob_redir.tests @@ -0,0 +1,9 @@ +# Redirections are not globbed. +# bash: +# if run as "sh", they are not globbed, but +# if run as "bash", they are! +>z.tmp +echo TEST >?.tmp +echo 'z.tmp:' `cat 'z.tmp'` +echo '?.tmp:' `cat '?.tmp'` +rm 'z.tmp' '?.tmp' diff --git a/shell/hush_test/hush-parsing/escape3.right b/shell/hush_test/hush-parsing/escape3.right new file mode 100644 index 000000000..da02a976a --- /dev/null +++ b/shell/hush_test/hush-parsing/escape3.right @@ -0,0 +1,23 @@ +v: a \ b \\ c \\\ d \\\\ e +v: a \ b \\ c \\\ d \\\\ e +Unquoted: +.a. +.\. +.b. +.\\. +.c. +.\\\. +.d. +.\\\\. +.e. +Quoted: +.a. +.\. +.b. +.\\. +.c. +.\\\. +.d. +.\\\\. +.e. +done diff --git a/shell/hush_test/hush-parsing/escape3.tests b/shell/hush_test/hush-parsing/escape3.tests new file mode 100755 index 000000000..111ed40a2 --- /dev/null +++ b/shell/hush_test/hush-parsing/escape3.tests @@ -0,0 +1,8 @@ +v='a \ b \\ c \\\ d \\\\ e' +echo v: $v +echo v: "$v" +echo Unquoted: +for a in $v; do echo .$a.; done +echo Quoted: +for a in $v; do echo ".$a."; done +echo done diff --git a/shell/hush_test/hush-parsing/redir_space.right b/shell/hush_test/hush-parsing/redir_space.right new file mode 100644 index 000000000..084295204 --- /dev/null +++ b/shell/hush_test/hush-parsing/redir_space.right @@ -0,0 +1,3 @@ +z1.tmp: 1 +z2.tmp: 1 +"z1.tmp z2.tmp": TEST 0 diff --git a/shell/hush_test/hush-parsing/redir_space.tests b/shell/hush_test/hush-parsing/redir_space.tests new file mode 100755 index 000000000..c0b543098 --- /dev/null +++ b/shell/hush_test/hush-parsing/redir_space.tests @@ -0,0 +1,6 @@ +v='z1.tmp z2.tmp' +echo TEST >$v +echo 'z1.tmp:' `cat 'z1.tmp' 2>/dev/null; echo $?` +echo 'z2.tmp:' `cat 'z2.tmp' 2>/dev/null; echo $?` +echo '"z1.tmp z2.tmp":' `cat 'z1.tmp z2.tmp' 2>/dev/null; echo $?` +rm z*.tmp -- cgit v1.2.3