aboutsummaryrefslogtreecommitdiff
path: root/shell/msh_test/msh-vars
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-03-02 19:57:53 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-03-02 19:57:53 +0000
commita43dba76ea394d789de67c6322b51e1d65bdba3b (patch)
treec99cde48cb834d4310ec06b3d377783029103ae1 /shell/msh_test/msh-vars
parent444639cc2134d483bf0845416e9b6ce8935af795 (diff)
downloadbusybox-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.right6
-rwxr-xr-xshell/msh_test/msh-vars/star.tests8
-rw-r--r--shell/msh_test/msh-vars/var.right4
-rwxr-xr-xshell/msh_test/msh-vars/var.tests9
-rw-r--r--shell/msh_test/msh-vars/var_subst_in_for.right40
-rwxr-xr-xshell/msh_test/msh-vars/var_subst_in_for.tests40
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 @@
1if test $# = 0; then
2 exec "$THIS_SH" star.tests 1 abc 'd e f'
3fi
4# 'd e f' should be split into 3 separate args:
5for a in $*; do echo ".$a."; done
6
7# must produce .1 abc d e f.
8for 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 @@
1http://busybox.net
2http://busybox.net_abc
31
41
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 @@
1URL=http://busybox.net
2
3echo $URL
4echo ${URL}_abc
5
6true
7false; echo $?
8true
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 @@
1Testing: in x y z
2.x.
3.y.
4.z.
5Testing: in u $empty v
6.u.
7.v.
8Testing: in u " $empty" v
9.u.
10. .
11.v.
12Testing: in u $empty $empty$a v
13.u.
14.a.
15.v.
16Testing: in $a_b
17.a.
18.b.
19Testing: in $*
20.abc.
21.d.
22.e.
23Testing: in $@
24.abc.
25.d.
26.e.
27Testing: in -$*-
28.-abc.
29.d.
30.e-.
31Testing: in -$@-
32.-abc.
33.d.
34.e-.
35Testing: in $a_b -$a_b-
36.a.
37.b.
38.-a.
39.b-.
40Finished
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 @@
1if test $# = 0; then
2 exec "$THIS_SH" var_subst_in_for.tests abc "d e"
3fi
4
5echo 'Testing: in x y z'
6for a in x y z; do echo ".$a."; done
7
8echo 'Testing: in u $empty v'
9empty=''
10for a in u $empty v; do echo ".$a."; done
11
12echo 'Testing: in u " $empty" v'
13empty=''
14for a in u " $empty" v; do echo ".$a."; done
15
16echo 'Testing: in u $empty $empty$a v'
17a='a'
18for a in u $empty $empty$a v; do echo ".$a."; done
19
20echo 'Testing: in $a_b'
21a_b='a b'
22for a in $a_b; do echo ".$a."; done
23
24echo 'Testing: in $*'
25for a in $*; do echo ".$a."; done
26
27echo 'Testing: in $@'
28for a in $@; do echo ".$a."; done
29
30echo 'Testing: in -$*-'
31for a in -$*-; do echo ".$a."; done
32
33echo 'Testing: in -$@-'
34for a in -$@-; do echo ".$a."; done
35
36echo 'Testing: in $a_b -$a_b-'
37a_b='a b'
38for a in $a_b -$a_b-; do echo ".$a."; done
39
40echo Finished