aboutsummaryrefslogtreecommitdiff
path: root/shell/hush_test/hush-vars
diff options
context:
space:
mode:
Diffstat (limited to 'shell/hush_test/hush-vars')
-rw-r--r--shell/hush_test/hush-vars/empty.right3
-rwxr-xr-xshell/hush_test/hush-vars/empty.tests5
-rw-r--r--shell/hush_test/hush-vars/glob_and_vars.right1
-rwxr-xr-xshell/hush_test/hush-vars/glob_and_vars.tests2
-rw-r--r--shell/hush_test/hush-vars/param_glob.right4
-rwxr-xr-xshell/hush_test/hush-vars/param_glob.tests10
-rw-r--r--shell/hush_test/hush-vars/star.right6
-rwxr-xr-xshell/hush_test/hush-vars/star.tests8
-rw-r--r--shell/hush_test/hush-vars/var1.right4
-rwxr-xr-xshell/hush_test/hush-vars/var1.tests9
-rw-r--r--shell/hush_test/hush-vars/var2.right2
-rwxr-xr-xshell/hush_test/hush-vars/var2.tests4
-rw-r--r--shell/hush_test/hush-vars/var_expand_in_assign.right5
-rwxr-xr-xshell/hush_test/hush-vars/var_expand_in_assign.tests15
-rw-r--r--shell/hush_test/hush-vars/var_expand_in_redir.right3
-rwxr-xr-xshell/hush_test/hush-vars/var_expand_in_redir.tests13
-rw-r--r--shell/hush_test/hush-vars/var_leaks.right1
-rwxr-xr-xshell/hush_test/hush-vars/var_leaks.tests14
-rw-r--r--shell/hush_test/hush-vars/var_preserved.right4
-rwxr-xr-xshell/hush_test/hush-vars/var_preserved.tests16
-rw-r--r--shell/hush_test/hush-vars/var_subst_in_for.right40
-rwxr-xr-xshell/hush_test/hush-vars/var_subst_in_for.tests40
22 files changed, 209 insertions, 0 deletions
diff --git a/shell/hush_test/hush-vars/empty.right b/shell/hush_test/hush-vars/empty.right
new file mode 100644
index 0000000..2cb3c70
--- /dev/null
+++ b/shell/hush_test/hush-vars/empty.right
@@ -0,0 +1,3 @@
+a b c d e f 1 2 3 4 5 6 7 8 9 0 A B C D E F
+a b c d e f 1 2 3 4 5 6 7 8 9 0 A B C D E F
+a b c d e f 1 2 3 4 5 6 7 8 9 0 A B C D E F
diff --git a/shell/hush_test/hush-vars/empty.tests b/shell/hush_test/hush-vars/empty.tests
new file mode 100755
index 0000000..a9c247e
--- /dev/null
+++ b/shell/hush_test/hush-vars/empty.tests
@@ -0,0 +1,5 @@
+e=
+
+echo a b c d e f 1 2 3 4 5 6 7 8 9 0 A B C D E F
+echo a $e b $e c $e d $e e $e f $e 1 $e 2 $e 3 $e 4 $e 5 $e 6 $e 7 $e 8 $e 9 $e 0 $e A $e B $e C $e D $e E $e F
+echo $e a $e b $e c $e d $e e $e f $e 1 $e 2 $e 3 $e 4 $e 5 $e 6 $e 7 $e 8 $e 9 $e 0 $e A $e B $e C $e D $e E $e F
diff --git a/shell/hush_test/hush-vars/glob_and_vars.right b/shell/hush_test/hush-vars/glob_and_vars.right
new file mode 100644
index 0000000..3ac7ec5
--- /dev/null
+++ b/shell/hush_test/hush-vars/glob_and_vars.right
@@ -0,0 +1 @@
+./glob_and_vars.right ./glob_and_vars.tests
diff --git a/shell/hush_test/hush-vars/glob_and_vars.tests b/shell/hush_test/hush-vars/glob_and_vars.tests
new file mode 100755
index 0000000..482cf9d
--- /dev/null
+++ b/shell/hush_test/hush-vars/glob_and_vars.tests
@@ -0,0 +1,2 @@
+v=.
+echo $v/glob_and_vars.[tr]*
diff --git a/shell/hush_test/hush-vars/param_glob.right b/shell/hush_test/hush-vars/param_glob.right
new file mode 100644
index 0000000..bdee8fe
--- /dev/null
+++ b/shell/hush_test/hush-vars/param_glob.right
@@ -0,0 +1,4 @@
+param_glob.tests
+param_glob.tests
+param_glob.t*
+param_glob.t*
diff --git a/shell/hush_test/hush-vars/param_glob.tests b/shell/hush_test/hush-vars/param_glob.tests
new file mode 100755
index 0000000..801d58e
--- /dev/null
+++ b/shell/hush_test/hush-vars/param_glob.tests
@@ -0,0 +1,10 @@
+if test $# = 0; then
+ #BUG in builtin_exec! will glob param!
+ #exec "$THIS_SH" "$0" 'param_glob.t*'
+ "$THIS_SH" "$0" 'param_glob.t*'
+ exit
+fi
+echo $*
+echo $@
+echo "$*"
+echo "$@"
diff --git a/shell/hush_test/hush-vars/star.right b/shell/hush_test/hush-vars/star.right
new file mode 100644
index 0000000..0ecc55b
--- /dev/null
+++ b/shell/hush_test/hush-vars/star.right
@@ -0,0 +1,6 @@
+.1.
+.abc.
+.d.
+.e.
+.f.
+.1 abc d e f.
diff --git a/shell/hush_test/hush-vars/star.tests b/shell/hush_test/hush-vars/star.tests
new file mode 100755
index 0000000..5554c40
--- /dev/null
+++ b/shell/hush_test/hush-vars/star.tests
@@ -0,0 +1,8 @@
+if test $# = 0; then
+ exec "$THIS_SH" star.tests 1 abc 'd e f'
+fi
+# 'd e f' should be split into 3 separate args:
+for a in $*; do echo ".$a."; done
+
+# must produce .1 abc d e f.
+for a in "$*"; do echo ".$a."; done
diff --git a/shell/hush_test/hush-vars/var1.right b/shell/hush_test/hush-vars/var1.right
new file mode 100644
index 0000000..14b2314
--- /dev/null
+++ b/shell/hush_test/hush-vars/var1.right
@@ -0,0 +1,4 @@
+http://busybox.net
+http://busybox.net_abc
+1
+1
diff --git a/shell/hush_test/hush-vars/var1.tests b/shell/hush_test/hush-vars/var1.tests
new file mode 100755
index 0000000..0a63696
--- /dev/null
+++ b/shell/hush_test/hush-vars/var1.tests
@@ -0,0 +1,9 @@
+URL=http://busybox.net
+
+echo $URL
+echo ${URL}_abc
+
+true
+false; echo $?
+true
+{ false; echo $?; }
diff --git a/shell/hush_test/hush-vars/var2.right b/shell/hush_test/hush-vars/var2.right
new file mode 100644
index 0000000..40bf4bf
--- /dev/null
+++ b/shell/hush_test/hush-vars/var2.right
@@ -0,0 +1,2 @@
+http://busybox.net
+http://busybox.net_abc
diff --git a/shell/hush_test/hush-vars/var2.tests b/shell/hush_test/hush-vars/var2.tests
new file mode 100755
index 0000000..1292410
--- /dev/null
+++ b/shell/hush_test/hush-vars/var2.tests
@@ -0,0 +1,4 @@
+_1=http://busybox.net
+
+echo $_1
+echo ${_1}_abc
diff --git a/shell/hush_test/hush-vars/var_expand_in_assign.right b/shell/hush_test/hush-vars/var_expand_in_assign.right
new file mode 100644
index 0000000..352210d
--- /dev/null
+++ b/shell/hush_test/hush-vars/var_expand_in_assign.right
@@ -0,0 +1,5 @@
+. .
+.abc d e.
+.abc d e.
+.abc d e.
+.abc d e.
diff --git a/shell/hush_test/hush-vars/var_expand_in_assign.tests b/shell/hush_test/hush-vars/var_expand_in_assign.tests
new file mode 100755
index 0000000..18cdc74
--- /dev/null
+++ b/shell/hush_test/hush-vars/var_expand_in_assign.tests
@@ -0,0 +1,15 @@
+if test $# = 0; then
+ exec "$THIS_SH" "$0" abc "d e"
+fi
+
+space=' '
+echo .$space.
+
+a=$*
+echo .$a.
+a=$@
+echo .$a.
+a="$*"
+echo .$a.
+a="$@"
+echo .$a.
diff --git a/shell/hush_test/hush-vars/var_expand_in_redir.right b/shell/hush_test/hush-vars/var_expand_in_redir.right
new file mode 100644
index 0000000..423299c
--- /dev/null
+++ b/shell/hush_test/hush-vars/var_expand_in_redir.right
@@ -0,0 +1,3 @@
+TEST1
+TEST2
+TEST3
diff --git a/shell/hush_test/hush-vars/var_expand_in_redir.tests b/shell/hush_test/hush-vars/var_expand_in_redir.tests
new file mode 100755
index 0000000..bda6bdd
--- /dev/null
+++ b/shell/hush_test/hush-vars/var_expand_in_redir.tests
@@ -0,0 +1,13 @@
+if test $# = 0; then
+ exec "$THIS_SH" "$0" abc "d e"
+fi
+
+echo TEST1 >"$1.out"
+echo TEST2 >"$2.out"
+# bash says: "$@.out": ambiguous redirect
+# ash handles it as if it is '$*' - we do the same
+echo TEST3 >"$@.out"
+
+cat abc.out "d e.out" "abc d e.out"
+
+rm abc.out "d e.out" "abc d e.out"
diff --git a/shell/hush_test/hush-vars/var_leaks.right b/shell/hush_test/hush-vars/var_leaks.right
new file mode 100644
index 0000000..d86bac9
--- /dev/null
+++ b/shell/hush_test/hush-vars/var_leaks.right
@@ -0,0 +1 @@
+OK
diff --git a/shell/hush_test/hush-vars/var_leaks.tests b/shell/hush_test/hush-vars/var_leaks.tests
new file mode 100755
index 0000000..27c8c65
--- /dev/null
+++ b/shell/hush_test/hush-vars/var_leaks.tests
@@ -0,0 +1,14 @@
+# external program
+a=b /bin/true
+env | grep ^a=
+
+# builtin
+a=b true
+env | grep ^a=
+
+# exec with redirection only
+# in bash, this leaks!
+a=b exec 1>&1
+env | grep ^a=
+
+echo OK
diff --git a/shell/hush_test/hush-vars/var_preserved.right b/shell/hush_test/hush-vars/var_preserved.right
new file mode 100644
index 0000000..2a9917c
--- /dev/null
+++ b/shell/hush_test/hush-vars/var_preserved.right
@@ -0,0 +1,4 @@
+a=b
+a=b
+a=b
+OK
diff --git a/shell/hush_test/hush-vars/var_preserved.tests b/shell/hush_test/hush-vars/var_preserved.tests
new file mode 100755
index 0000000..1bddd87
--- /dev/null
+++ b/shell/hush_test/hush-vars/var_preserved.tests
@@ -0,0 +1,16 @@
+export a=b
+
+# external program
+a=c /bin/true
+env | grep ^a=
+
+# builtin
+a=d true
+env | grep ^a=
+
+# exec with redirection only
+# in bash, this leaks!
+a=e exec 1>&1
+env | grep ^a=
+
+echo OK
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 0000000..c8aca1c
--- /dev/null
+++ b/shell/hush_test/hush-vars/var_subst_in_for.right
@@ -0,0 +1,40 @@
+Testing: in x y z
+.x.
+.y.
+.z.
+Testing: in u $empty v
+.u.
+.v.
+Testing: in u " $empty" v
+.u.
+. .
+.v.
+Testing: in u $empty $empty$a v
+.u.
+.a.
+.v.
+Testing: in $a_b
+.a.
+.b.
+Testing: in $*
+.abc.
+.d.
+.e.
+Testing: in $@
+.abc.
+.d.
+.e.
+Testing: in -$*-
+.-abc.
+.d.
+.e-.
+Testing: in -$@-
+.-abc.
+.d.
+.e-.
+Testing: in $a_b -$a_b-
+.a.
+.b.
+.-a.
+.b-.
+Finished
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 100755
index 0000000..433c606
--- /dev/null
+++ b/shell/hush_test/hush-vars/var_subst_in_for.tests
@@ -0,0 +1,40 @@
+if test $# = 0; then
+ exec "$THIS_SH" "$0" abc "d e"
+fi
+
+echo 'Testing: in x y z'
+for a in x y z; do echo ".$a."; done
+
+echo 'Testing: in u $empty v'
+empty=''
+for a in u $empty v; do echo ".$a."; done
+
+echo 'Testing: in u " $empty" v'
+empty=''
+for a in u " $empty" v; do echo ".$a."; done
+
+echo 'Testing: in u $empty $empty$a v'
+a='a'
+for a in u $empty $empty$a v; do echo ".$a."; done
+
+echo 'Testing: in $a_b'
+a_b='a b'
+for a in $a_b; do echo ".$a."; done
+
+echo 'Testing: in $*'
+for a in $*; do echo ".$a."; done
+
+echo 'Testing: in $@'
+for a in $@; do echo ".$a."; done
+
+echo 'Testing: in -$*-'
+for a in -$*-; do echo ".$a."; done
+
+echo 'Testing: in -$@-'
+for a in -$@-; do echo ".$a."; done
+
+echo 'Testing: in $a_b -$a_b-'
+a_b='a b'
+for a in $a_b -$a_b-; do echo ".$a."; done
+
+echo Finished