shell: some additions to *sh-misc/* tests
authorDenys Vlasenko <vda.linux@googlemail.com>
Mon, 24 Jul 2017 16:51:40 +0000 (18:51 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Mon, 24 Jul 2017 16:51:40 +0000 (18:51 +0200)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
shell/ash_test/ash-misc/assignment2.right [new file with mode: 0644]
shell/ash_test/ash-misc/assignment2.tests [new file with mode: 0755]
shell/ash_test/ash-misc/empty_args.right [new file with mode: 0644]
shell/ash_test/ash-misc/empty_args.tests [new file with mode: 0755]
shell/ash_test/ash-misc/env_and_func.right [new file with mode: 0644]
shell/ash_test/ash-misc/env_and_func.tests [new file with mode: 0755]
shell/hush_test/hush-misc/env_and_func.tests

diff --git a/shell/ash_test/ash-misc/assignment2.right b/shell/ash_test/ash-misc/assignment2.right
new file mode 100644 (file)
index 0000000..179c71c
--- /dev/null
@@ -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 (executable)
index 0000000..f693843
--- /dev/null
@@ -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 (file)
index 0000000..968b5a4
--- /dev/null
@@ -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 (executable)
index 0000000..efce549
--- /dev/null
@@ -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 (file)
index 0000000..5fc3488
--- /dev/null
@@ -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 (executable)
index 0000000..3efef1a
--- /dev/null
@@ -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"
index 1d4eaf3a72c51a9e8ebfe29ac46dfb996937e5cc..3efef1a41945e92f7f3f96033a793d5f9831ed1b 100755 (executable)
@@ -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"