ash: add tests adapted from hush glob tests. glob2.tests currently fails
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
68acc0f835
commit
66a781acb9
2
shell/ash_test/ash-glob/glob1.right
Normal file
2
shell/ash_test/ash-glob/glob1.right
Normal file
@ -0,0 +1,2 @@
|
||||
glob1.tests
|
||||
glob1.tests
|
2
shell/ash_test/ash-glob/glob1.tests
Executable file
2
shell/ash_test/ash-glob/glob1.tests
Executable file
@ -0,0 +1,2 @@
|
||||
echo *glob1?t[e]sts*
|
||||
echo "glob1"?'t'[e]s*
|
18
shell/ash_test/ash-glob/glob2.right
Normal file
18
shell/ash_test/ash-glob/glob2.right
Normal file
@ -0,0 +1,18 @@
|
||||
Expected Actual
|
||||
Z\* : Z\*
|
||||
Z* : Z*
|
||||
Z\f : Z\f
|
||||
Z\* : Z\*
|
||||
|
||||
Z\z : Z\z
|
||||
Zz : Zz
|
||||
Z\z : Z\z
|
||||
Z\z : Z\z
|
||||
|
||||
Z\ : Z\
|
||||
Z\ : Z\
|
||||
|
||||
Z\f Zf : Z\f Zf
|
||||
Z\f Zf : Z\f Zf
|
||||
|
||||
Done: 0
|
27
shell/ash_test/ash-glob/glob2.tests
Executable file
27
shell/ash_test/ash-glob/glob2.tests
Executable file
@ -0,0 +1,27 @@
|
||||
# This test demonstrates that in unquoted $v, backslashes expand by this rule:
|
||||
# \z -> \\\z; \<eol> -> \\<eol> (for any z, special or not),
|
||||
# and subsequently globbing converts \\ to \ and treats \z as literal z
|
||||
# even if it is a special char.
|
||||
|
||||
>'Zf'
|
||||
>'Z\f'
|
||||
echo 'Expected' 'Actual'
|
||||
v='\*'; echo 'Z\* :' Z$v # ash is buggy here: prints 'Z\f'
|
||||
echo 'Z* :' Z\*
|
||||
echo 'Z\f :' Z\\*
|
||||
echo 'Z\* :' Z\\\* # NB! only this matches Z$v output
|
||||
echo
|
||||
v='\z'; echo 'Z\z :' Z$v
|
||||
echo 'Zz :' Z\z
|
||||
echo 'Z\z :' Z\\z
|
||||
echo 'Z\z :' Z\\\z
|
||||
echo
|
||||
v='\'; echo 'Z\ :' Z$v
|
||||
echo 'Z\ :' Z\\
|
||||
echo
|
||||
v='*'; echo 'Z\f Zf :' Z$v
|
||||
echo 'Z\f Zf :' Z*
|
||||
echo
|
||||
|
||||
rm 'Z\f' 'Zf'
|
||||
echo Done: $?
|
6
shell/ash_test/ash-glob/glob_and_assign.right
Normal file
6
shell/ash_test/ash-glob/glob_and_assign.right
Normal file
@ -0,0 +1,6 @@
|
||||
ZVAR=z.tmp ZVAR=*.tmp ZVAR=[z].tmp
|
||||
ZVAR=z.tmp ZVAR=*.tmp ZVAR=[z].tmp
|
||||
*.tmp
|
||||
ZVAR=z.tmp z.tmp
|
||||
ZVAR=z.tmp ZVAR=*.tmp ZVAR=[z].tmp
|
||||
ZVAR=z.tmp ZVAR=*.tmp ZVAR=[z].tmp
|
10
shell/ash_test/ash-glob/glob_and_assign.tests
Executable file
10
shell/ash_test/ash-glob/glob_and_assign.tests
Executable file
@ -0,0 +1,10 @@
|
||||
>ZVAR=z.tmp
|
||||
>z.tmp
|
||||
ZVAR=*.tmp echo ZVAR=*.tmp "ZVAR=*.tmp" "ZVAR=[z].tmp"
|
||||
ZVAR=*.tmp /bin/echo ZVAR=*.tmp "ZVAR=*.tmp" "ZVAR=[z].tmp"
|
||||
ZVAR=*.tmp
|
||||
echo "$ZVAR"
|
||||
echo $ZVAR
|
||||
echo ZVAR=*.tmp "ZVAR=*.tmp" "ZVAR=[z].tmp"
|
||||
/bin/echo ZVAR=*.tmp "ZVAR=*.tmp" "ZVAR=[z].tmp"
|
||||
rm ZVAR=z.tmp z.tmp
|
2
shell/ash_test/ash-glob/glob_redir.right
Normal file
2
shell/ash_test/ash-glob/glob_redir.right
Normal file
@ -0,0 +1,2 @@
|
||||
z.tmp:
|
||||
?.tmp: TEST
|
9
shell/ash_test/ash-glob/glob_redir.tests
Executable file
9
shell/ash_test/ash-glob/glob_redir.tests
Executable file
@ -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'
|
Loading…
Reference in New Issue
Block a user