diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2015-09-04 03:27:08 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2015-09-04 03:27:08 +0200 |
commit | 66a781acb9c3a78f3063d1e691a1b18a5f9f68ab (patch) | |
tree | 073d09fba413f09923e0ef3e59c4f762771f8842 | |
parent | 68acc0f835360d439c65d349812b817b1ce5dc61 (diff) | |
download | busybox-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.right | 2 | ||||
-rwxr-xr-x | shell/ash_test/ash-glob/glob1.tests | 2 | ||||
-rw-r--r-- | shell/ash_test/ash-glob/glob2.right | 18 | ||||
-rwxr-xr-x | shell/ash_test/ash-glob/glob2.tests | 27 | ||||
-rw-r--r-- | shell/ash_test/ash-glob/glob_and_assign.right | 6 | ||||
-rwxr-xr-x | shell/ash_test/ash-glob/glob_and_assign.tests | 10 | ||||
-rw-r--r-- | shell/ash_test/ash-glob/glob_redir.right | 2 | ||||
-rwxr-xr-x | shell/ash_test/ash-glob/glob_redir.tests | 9 |
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 @@ | |||
1 | glob1.tests | ||
2 | glob1.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 @@ | |||
1 | echo *glob1?t[e]sts* | ||
2 | echo "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 @@ | |||
1 | Expected Actual | ||
2 | Z\* : Z\* | ||
3 | Z* : Z* | ||
4 | Z\f : Z\f | ||
5 | Z\* : Z\* | ||
6 | |||
7 | Z\z : Z\z | ||
8 | Zz : Zz | ||
9 | Z\z : Z\z | ||
10 | Z\z : Z\z | ||
11 | |||
12 | Z\ : Z\ | ||
13 | Z\ : Z\ | ||
14 | |||
15 | Z\f Zf : Z\f Zf | ||
16 | Z\f Zf : Z\f Zf | ||
17 | |||
18 | Done: 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' | ||
9 | v='\*'; 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 | ||
13 | echo | ||
14 | v='\z'; echo 'Z\z :' Z$v | ||
15 | echo 'Zz :' Z\z | ||
16 | echo 'Z\z :' Z\\z | ||
17 | echo 'Z\z :' Z\\\z | ||
18 | echo | ||
19 | v='\'; echo 'Z\ :' Z$v | ||
20 | echo 'Z\ :' Z\\ | ||
21 | echo | ||
22 | v='*'; echo 'Z\f Zf :' Z$v | ||
23 | echo 'Z\f Zf :' Z* | ||
24 | echo | ||
25 | |||
26 | rm 'Z\f' 'Zf' | ||
27 | echo 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 @@ | |||
1 | ZVAR=z.tmp ZVAR=*.tmp ZVAR=[z].tmp | ||
2 | ZVAR=z.tmp ZVAR=*.tmp ZVAR=[z].tmp | ||
3 | *.tmp | ||
4 | ZVAR=z.tmp z.tmp | ||
5 | ZVAR=z.tmp ZVAR=*.tmp ZVAR=[z].tmp | ||
6 | ZVAR=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 | ||
3 | ZVAR=*.tmp echo ZVAR=*.tmp "ZVAR=*.tmp" "ZVAR=[z].tmp" | ||
4 | ZVAR=*.tmp /bin/echo ZVAR=*.tmp "ZVAR=*.tmp" "ZVAR=[z].tmp" | ||
5 | ZVAR=*.tmp | ||
6 | echo "$ZVAR" | ||
7 | echo $ZVAR | ||
8 | echo ZVAR=*.tmp "ZVAR=*.tmp" "ZVAR=[z].tmp" | ||
9 | /bin/echo ZVAR=*.tmp "ZVAR=*.tmp" "ZVAR=[z].tmp" | ||
10 | rm 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 @@ | |||
1 | z.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 | ||
6 | echo TEST >?.tmp | ||
7 | echo 'z.tmp:' `cat 'z.tmp'` | ||
8 | echo '?.tmp:' `cat '?.tmp'` | ||
9 | rm 'z.tmp' '?.tmp' | ||