aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2015-09-04 03:27:08 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2015-09-04 03:27:08 +0200
commit66a781acb9c3a78f3063d1e691a1b18a5f9f68ab (patch)
tree073d09fba413f09923e0ef3e59c4f762771f8842
parent68acc0f835360d439c65d349812b817b1ce5dc61 (diff)
downloadbusybox-w32-66a781acb9c3a78f3063d1e691a1b18a5f9f68ab.tar.gz
busybox-w32-66a781acb9c3a78f3063d1e691a1b18a5f9f68ab.tar.bz2
busybox-w32-66a781acb9c3a78f3063d1e691a1b18a5f9f68ab.zip
ash: add tests adapted from hush glob tests. glob2.tests currently fails
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--shell/ash_test/ash-glob/glob1.right2
-rwxr-xr-xshell/ash_test/ash-glob/glob1.tests2
-rw-r--r--shell/ash_test/ash-glob/glob2.right18
-rwxr-xr-xshell/ash_test/ash-glob/glob2.tests27
-rw-r--r--shell/ash_test/ash-glob/glob_and_assign.right6
-rwxr-xr-xshell/ash_test/ash-glob/glob_and_assign.tests10
-rw-r--r--shell/ash_test/ash-glob/glob_redir.right2
-rwxr-xr-xshell/ash_test/ash-glob/glob_redir.tests9
8 files changed, 76 insertions, 0 deletions
diff --git a/shell/ash_test/ash-glob/glob1.right b/shell/ash_test/ash-glob/glob1.right
new file mode 100644
index 000000000..f29ab4e65
--- /dev/null
+++ b/shell/ash_test/ash-glob/glob1.right
@@ -0,0 +1,2 @@
1glob1.tests
2glob1.tests
diff --git a/shell/ash_test/ash-glob/glob1.tests b/shell/ash_test/ash-glob/glob1.tests
new file mode 100755
index 000000000..f980ce064
--- /dev/null
+++ b/shell/ash_test/ash-glob/glob1.tests
@@ -0,0 +1,2 @@
1echo *glob1?t[e]sts*
2echo "glob1"?'t'[e]s*
diff --git a/shell/ash_test/ash-glob/glob2.right b/shell/ash_test/ash-glob/glob2.right
new file mode 100644
index 000000000..7a70c2263
--- /dev/null
+++ b/shell/ash_test/ash-glob/glob2.right
@@ -0,0 +1,18 @@
1Expected Actual
2Z\* : Z\*
3Z* : Z*
4Z\f : Z\f
5Z\* : Z\*
6
7Z\z : Z\z
8Zz : Zz
9Z\z : Z\z
10Z\z : Z\z
11
12Z\ : Z\
13Z\ : Z\
14
15Z\f Zf : Z\f Zf
16Z\f Zf : Z\f Zf
17
18Done: 0
diff --git a/shell/ash_test/ash-glob/glob2.tests b/shell/ash_test/ash-glob/glob2.tests
new file mode 100755
index 000000000..00618b9db
--- /dev/null
+++ b/shell/ash_test/ash-glob/glob2.tests
@@ -0,0 +1,27 @@
1# This test demonstrates that in unquoted $v, backslashes expand by this rule:
2# \z -> \\\z; \<eol> -> \\<eol> (for any z, special or not),
3# and subsequently globbing converts \\ to \ and treats \z as literal z
4# even if it is a special char.
5
6>'Zf'
7>'Z\f'
8 echo 'Expected' 'Actual'
9v='\*'; echo 'Z\* :' Z$v # ash is buggy here: prints 'Z\f'
10 echo 'Z* :' Z\*
11 echo 'Z\f :' Z\\*
12 echo 'Z\* :' Z\\\* # NB! only this matches Z$v output
13echo
14v='\z'; echo 'Z\z :' Z$v
15 echo 'Zz :' Z\z
16 echo 'Z\z :' Z\\z
17 echo 'Z\z :' Z\\\z
18echo
19v='\'; echo 'Z\ :' Z$v
20 echo 'Z\ :' Z\\
21echo
22v='*'; echo 'Z\f Zf :' Z$v
23 echo 'Z\f Zf :' Z*
24echo
25
26rm 'Z\f' 'Zf'
27echo Done: $?
diff --git a/shell/ash_test/ash-glob/glob_and_assign.right b/shell/ash_test/ash-glob/glob_and_assign.right
new file mode 100644
index 000000000..d46e44363
--- /dev/null
+++ b/shell/ash_test/ash-glob/glob_and_assign.right
@@ -0,0 +1,6 @@
1ZVAR=z.tmp ZVAR=*.tmp ZVAR=[z].tmp
2ZVAR=z.tmp ZVAR=*.tmp ZVAR=[z].tmp
3*.tmp
4ZVAR=z.tmp z.tmp
5ZVAR=z.tmp ZVAR=*.tmp ZVAR=[z].tmp
6ZVAR=z.tmp ZVAR=*.tmp ZVAR=[z].tmp
diff --git a/shell/ash_test/ash-glob/glob_and_assign.tests b/shell/ash_test/ash-glob/glob_and_assign.tests
new file mode 100755
index 000000000..0b158f20f
--- /dev/null
+++ b/shell/ash_test/ash-glob/glob_and_assign.tests
@@ -0,0 +1,10 @@
1>ZVAR=z.tmp
2>z.tmp
3ZVAR=*.tmp echo ZVAR=*.tmp "ZVAR=*.tmp" "ZVAR=[z].tmp"
4ZVAR=*.tmp /bin/echo ZVAR=*.tmp "ZVAR=*.tmp" "ZVAR=[z].tmp"
5ZVAR=*.tmp
6echo "$ZVAR"
7echo $ZVAR
8echo ZVAR=*.tmp "ZVAR=*.tmp" "ZVAR=[z].tmp"
9/bin/echo ZVAR=*.tmp "ZVAR=*.tmp" "ZVAR=[z].tmp"
10rm ZVAR=z.tmp z.tmp
diff --git a/shell/ash_test/ash-glob/glob_redir.right b/shell/ash_test/ash-glob/glob_redir.right
new file mode 100644
index 000000000..fbd0309b0
--- /dev/null
+++ b/shell/ash_test/ash-glob/glob_redir.right
@@ -0,0 +1,2 @@
1z.tmp:
2?.tmp: TEST
diff --git a/shell/ash_test/ash-glob/glob_redir.tests b/shell/ash_test/ash-glob/glob_redir.tests
new file mode 100755
index 000000000..621d12017
--- /dev/null
+++ b/shell/ash_test/ash-glob/glob_redir.tests
@@ -0,0 +1,9 @@
1# Redirections are not globbed.
2# bash:
3# if run as "sh", they are not globbed, but
4# if run as "bash", they are!
5>z.tmp
6echo TEST >?.tmp
7echo 'z.tmp:' `cat 'z.tmp'`
8echo '?.tmp:' `cat '?.tmp'`
9rm 'z.tmp' '?.tmp'