aboutsummaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2017-07-24 18:51:40 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2017-07-24 18:51:40 +0200
commitca50caacad8354fe97eb0da23075521156c0c0d6 (patch)
tree25ac13df95cea6f1fc8cb3fe96dbe6101b48a250 /shell
parentb920a38dc0a87f5884444d4731a8b887b5e16018 (diff)
downloadbusybox-ca50caacad8354fe97eb0da23075521156c0c0d6.tar.gz
shell: some additions to *sh-misc/* tests
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell')
-rw-r--r--shell/ash_test/ash-misc/assignment2.right2
-rwxr-xr-xshell/ash_test/ash-misc/assignment2.tests3
-rw-r--r--shell/ash_test/ash-misc/empty_args.right6
-rwxr-xr-xshell/ash_test/ash-misc/empty_args.tests9
-rw-r--r--shell/ash_test/ash-misc/env_and_func.right2
-rwxr-xr-xshell/ash_test/ash-misc/env_and_func.tests8
-rwxr-xr-xshell/hush_test/hush-misc/env_and_func.tests4
7 files changed, 34 insertions, 0 deletions
diff --git a/shell/ash_test/ash-misc/assignment2.right b/shell/ash_test/ash-misc/assignment2.right
new file mode 100644
index 000000000..179c71c5a
--- /dev/null
+++ b/shell/ash_test/ash-misc/assignment2.right
@@ -0,0 +1,2 @@
+./assignment2.tests: line 2: a=b: not found
+127
diff --git a/shell/ash_test/ash-misc/assignment2.tests b/shell/ash_test/ash-misc/assignment2.tests
new file mode 100755
index 000000000..f6938434c
--- /dev/null
+++ b/shell/ash_test/ash-misc/assignment2.tests
@@ -0,0 +1,3 @@
+# This must not be interpreted as an assignment
+a''=b true
+echo $?
diff --git a/shell/ash_test/ash-misc/empty_args.right b/shell/ash_test/ash-misc/empty_args.right
new file mode 100644
index 000000000..968b5a4d9
--- /dev/null
+++ b/shell/ash_test/ash-misc/empty_args.right
@@ -0,0 +1,6 @@
+Null 0th arg:
+./empty_args.tests: line 2: : Permission denied
+127
+Null 1st arg:
+0
+Null arg in exec:
diff --git a/shell/ash_test/ash-misc/empty_args.tests b/shell/ash_test/ash-misc/empty_args.tests
new file mode 100755
index 000000000..efce5494a
--- /dev/null
+++ b/shell/ash_test/ash-misc/empty_args.tests
@@ -0,0 +1,9 @@
+echo Null 0th arg:
+""
+echo $?
+echo Null 1st arg:
+# printf without args would print usage info
+printf ""
+echo $?
+echo Null arg in exec:
+exec printf ""
diff --git a/shell/ash_test/ash-misc/env_and_func.right b/shell/ash_test/ash-misc/env_and_func.right
new file mode 100644
index 000000000..5fc3488ae
--- /dev/null
+++ b/shell/ash_test/ash-misc/env_and_func.right
@@ -0,0 +1,2 @@
+var=val
+var=val
diff --git a/shell/ash_test/ash-misc/env_and_func.tests b/shell/ash_test/ash-misc/env_and_func.tests
new file mode 100755
index 000000000..3efef1a41
--- /dev/null
+++ b/shell/ash_test/ash-misc/env_and_func.tests
@@ -0,0 +1,8 @@
+var=old
+f() { echo "var=$var"; }
+# bash: POSIXLY_CORRECT behavior is to "leak" new variable values
+# out of function invocations (similar to "special builtins" behavior);
+# but in "bash mode", they don't leak.
+# hush does not "leak" values. ash does.
+var=val f
+echo "var=$var"
diff --git a/shell/hush_test/hush-misc/env_and_func.tests b/shell/hush_test/hush-misc/env_and_func.tests
index 1d4eaf3a7..3efef1a41 100755
--- a/shell/hush_test/hush-misc/env_and_func.tests
+++ b/shell/hush_test/hush-misc/env_and_func.tests
@@ -1,4 +1,8 @@
var=old
f() { echo "var=$var"; }
+# bash: POSIXLY_CORRECT behavior is to "leak" new variable values
+# out of function invocations (similar to "special builtins" behavior);
+# but in "bash mode", they don't leak.
+# hush does not "leak" values. ash does.
var=val f
echo "var=$var"