diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-03-02 19:57:53 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-03-02 19:57:53 +0000 |
commit | a43dba76ea394d789de67c6322b51e1d65bdba3b (patch) | |
tree | c99cde48cb834d4310ec06b3d377783029103ae1 /shell/msh_test/msh-vars | |
parent | 444639cc2134d483bf0845416e9b6ce8935af795 (diff) | |
download | busybox-w32-a43dba76ea394d789de67c6322b51e1d65bdba3b.tar.gz busybox-w32-a43dba76ea394d789de67c6322b51e1d65bdba3b.tar.bz2 busybox-w32-a43dba76ea394d789de67c6322b51e1d65bdba3b.zip |
msh: create testsuite (based on hush one)
hush: add TODO (doesn't know ":" command)
Diffstat (limited to 'shell/msh_test/msh-vars')
-rw-r--r-- | shell/msh_test/msh-vars/star.right | 6 | ||||
-rwxr-xr-x | shell/msh_test/msh-vars/star.tests | 8 | ||||
-rw-r--r-- | shell/msh_test/msh-vars/var.right | 4 | ||||
-rwxr-xr-x | shell/msh_test/msh-vars/var.tests | 9 | ||||
-rw-r--r-- | shell/msh_test/msh-vars/var_subst_in_for.right | 40 | ||||
-rwxr-xr-x | shell/msh_test/msh-vars/var_subst_in_for.tests | 40 |
6 files changed, 107 insertions, 0 deletions
diff --git a/shell/msh_test/msh-vars/star.right b/shell/msh_test/msh-vars/star.right new file mode 100644 index 000000000..0ecc55bc2 --- /dev/null +++ b/shell/msh_test/msh-vars/star.right | |||
@@ -0,0 +1,6 @@ | |||
1 | .1. | ||
2 | .abc. | ||
3 | .d. | ||
4 | .e. | ||
5 | .f. | ||
6 | .1 abc d e f. | ||
diff --git a/shell/msh_test/msh-vars/star.tests b/shell/msh_test/msh-vars/star.tests new file mode 100755 index 000000000..5554c4090 --- /dev/null +++ b/shell/msh_test/msh-vars/star.tests | |||
@@ -0,0 +1,8 @@ | |||
1 | if test $# = 0; then | ||
2 | exec "$THIS_SH" star.tests 1 abc 'd e f' | ||
3 | fi | ||
4 | # 'd e f' should be split into 3 separate args: | ||
5 | for a in $*; do echo ".$a."; done | ||
6 | |||
7 | # must produce .1 abc d e f. | ||
8 | for a in "$*"; do echo ".$a."; done | ||
diff --git a/shell/msh_test/msh-vars/var.right b/shell/msh_test/msh-vars/var.right new file mode 100644 index 000000000..14b2314d9 --- /dev/null +++ b/shell/msh_test/msh-vars/var.right | |||
@@ -0,0 +1,4 @@ | |||
1 | http://busybox.net | ||
2 | http://busybox.net_abc | ||
3 | 1 | ||
4 | 1 | ||
diff --git a/shell/msh_test/msh-vars/var.tests b/shell/msh_test/msh-vars/var.tests new file mode 100755 index 000000000..0a63696c9 --- /dev/null +++ b/shell/msh_test/msh-vars/var.tests | |||
@@ -0,0 +1,9 @@ | |||
1 | URL=http://busybox.net | ||
2 | |||
3 | echo $URL | ||
4 | echo ${URL}_abc | ||
5 | |||
6 | true | ||
7 | false; echo $? | ||
8 | true | ||
9 | { false; echo $?; } | ||
diff --git a/shell/msh_test/msh-vars/var_subst_in_for.right b/shell/msh_test/msh-vars/var_subst_in_for.right new file mode 100644 index 000000000..c8aca1c12 --- /dev/null +++ b/shell/msh_test/msh-vars/var_subst_in_for.right | |||
@@ -0,0 +1,40 @@ | |||
1 | Testing: in x y z | ||
2 | .x. | ||
3 | .y. | ||
4 | .z. | ||
5 | Testing: in u $empty v | ||
6 | .u. | ||
7 | .v. | ||
8 | Testing: in u " $empty" v | ||
9 | .u. | ||
10 | . . | ||
11 | .v. | ||
12 | Testing: in u $empty $empty$a v | ||
13 | .u. | ||
14 | .a. | ||
15 | .v. | ||
16 | Testing: in $a_b | ||
17 | .a. | ||
18 | .b. | ||
19 | Testing: in $* | ||
20 | .abc. | ||
21 | .d. | ||
22 | .e. | ||
23 | Testing: in $@ | ||
24 | .abc. | ||
25 | .d. | ||
26 | .e. | ||
27 | Testing: in -$*- | ||
28 | .-abc. | ||
29 | .d. | ||
30 | .e-. | ||
31 | Testing: in -$@- | ||
32 | .-abc. | ||
33 | .d. | ||
34 | .e-. | ||
35 | Testing: in $a_b -$a_b- | ||
36 | .a. | ||
37 | .b. | ||
38 | .-a. | ||
39 | .b-. | ||
40 | Finished | ||
diff --git a/shell/msh_test/msh-vars/var_subst_in_for.tests b/shell/msh_test/msh-vars/var_subst_in_for.tests new file mode 100755 index 000000000..4d1c11201 --- /dev/null +++ b/shell/msh_test/msh-vars/var_subst_in_for.tests | |||
@@ -0,0 +1,40 @@ | |||
1 | if test $# = 0; then | ||
2 | exec "$THIS_SH" var_subst_in_for.tests abc "d e" | ||
3 | fi | ||
4 | |||
5 | echo 'Testing: in x y z' | ||
6 | for a in x y z; do echo ".$a."; done | ||
7 | |||
8 | echo 'Testing: in u $empty v' | ||
9 | empty='' | ||
10 | for a in u $empty v; do echo ".$a."; done | ||
11 | |||
12 | echo 'Testing: in u " $empty" v' | ||
13 | empty='' | ||
14 | for a in u " $empty" v; do echo ".$a."; done | ||
15 | |||
16 | echo 'Testing: in u $empty $empty$a v' | ||
17 | a='a' | ||
18 | for a in u $empty $empty$a v; do echo ".$a."; done | ||
19 | |||
20 | echo 'Testing: in $a_b' | ||
21 | a_b='a b' | ||
22 | for a in $a_b; do echo ".$a."; done | ||
23 | |||
24 | echo 'Testing: in $*' | ||
25 | for a in $*; do echo ".$a."; done | ||
26 | |||
27 | echo 'Testing: in $@' | ||
28 | for a in $@; do echo ".$a."; done | ||
29 | |||
30 | echo 'Testing: in -$*-' | ||
31 | for a in -$*-; do echo ".$a."; done | ||
32 | |||
33 | echo 'Testing: in -$@-' | ||
34 | for a in -$@-; do echo ".$a."; done | ||
35 | |||
36 | echo 'Testing: in $a_b -$a_b-' | ||
37 | a_b='a b' | ||
38 | for a in $a_b -$a_b-; do echo ".$a."; done | ||
39 | |||
40 | echo Finished | ||