aboutsummaryrefslogtreecommitdiff
path: root/shell/hush_test
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-05-14 16:19:34 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-05-14 16:19:34 +0000
commit03eb8bf6ce2cef8f30402b7c2b18e8479f9da1ea (patch)
tree2ca7e7d1fba638187467c1597f2746b0163c9e76 /shell/hush_test
parent602d13cba552fadb8481283aa7872a4b9f206c48 (diff)
downloadbusybox-w32-03eb8bf6ce2cef8f30402b7c2b18e8479f9da1ea.tar.gz
busybox-w32-03eb8bf6ce2cef8f30402b7c2b18e8479f9da1ea.tar.bz2
busybox-w32-03eb8bf6ce2cef8f30402b7c2b18e8479f9da1ea.zip
hush: move towards more correct variable expansion
hush: fix a few cases in FOR v IN ... construct unfortunately, code growth is big - ~600 bytes
Diffstat (limited to 'shell/hush_test')
-rw-r--r--shell/hush_test/hush-bugs/quote3.right8
-rw-r--r--shell/hush_test/hush-bugs/quote3.tests12
-rw-r--r--shell/hush_test/hush-vars/var_subst_in_for.right40
-rw-r--r--shell/hush_test/hush-vars/var_subst_in_for.tests40
4 files changed, 100 insertions, 0 deletions
diff --git a/shell/hush_test/hush-bugs/quote3.right b/shell/hush_test/hush-bugs/quote3.right
new file mode 100644
index 000000000..11443f54b
--- /dev/null
+++ b/shell/hush_test/hush-bugs/quote3.right
@@ -0,0 +1,8 @@
1Testing: in $empty""
2..
3Testing: in "$*"
4.abc d e.
5Testing: in "$@"
6.abc.
7.d e.
8Finished
diff --git a/shell/hush_test/hush-bugs/quote3.tests b/shell/hush_test/hush-bugs/quote3.tests
new file mode 100644
index 000000000..c52e040cc
--- /dev/null
+++ b/shell/hush_test/hush-bugs/quote3.tests
@@ -0,0 +1,12 @@
1if test $# = 0; then
2 exec "$THIS_SH" quote3.tests abc "d e"
3fi
4
5echo 'Testing: in $empty""'
6empty=''
7for a in $empty""; do echo ".$a."; done
8echo 'Testing: in "$*"'
9for a in "$*"; do echo ".$a."; done
10echo 'Testing: in "$@"'
11for a in "$@"; do echo ".$a."; done
12echo Finished
diff --git a/shell/hush_test/hush-vars/var_subst_in_for.right b/shell/hush_test/hush-vars/var_subst_in_for.right
new file mode 100644
index 000000000..c8aca1c12
--- /dev/null
+++ b/shell/hush_test/hush-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/hush_test/hush-vars/var_subst_in_for.tests b/shell/hush_test/hush-vars/var_subst_in_for.tests
new file mode 100644
index 000000000..4d1c11201
--- /dev/null
+++ b/shell/hush_test/hush-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