summaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorDenys Vlasenko2021-07-25 22:03:16 +0200
committerDenys Vlasenko2021-07-25 22:03:16 +0200
commit05c5d745f7b14e265144489b7809a3d6dbbadec6 (patch)
tree2c845850220a961dfb03d36185f0a1f8ec03fddb /shell
parent53d45c934f54b7931cc736eba42903cb1f6d4632 (diff)
downloadbusybox-05c5d745f7b14e265144489b7809a3d6dbbadec6.zip
busybox-05c5d745f7b14e265144489b7809a3d6dbbadec6.tar.gz
ahell: update testsuite
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell')
-rw-r--r--shell/ash_test/ash-vars/var6.right2
-rwxr-xr-xshell/ash_test/ash-vars/var6.tests5
-rw-r--r--shell/ash_test/ash-vars/var_nested1.right3
-rwxr-xr-xshell/ash_test/ash-vars/var_nested1.tests16
-rw-r--r--shell/ash_test/ash-vars/var_nested2.right1
-rwxr-xr-xshell/ash_test/ash-vars/var_nested2.tests2
-rwxr-xr-xshell/hush_test/hush-vars/var6.tests7
7 files changed, 33 insertions, 3 deletions
diff --git a/shell/ash_test/ash-vars/var6.right b/shell/ash_test/ash-vars/var6.right
new file mode 100644
index 0000000..b37417f
--- /dev/null
+++ b/shell/ash_test/ash-vars/var6.right
@@ -0,0 +1,2 @@
+SHELL: line 1: syntax error: bad substitution
+SHELL: line 1: syntax error: bad substitution
diff --git a/shell/ash_test/ash-vars/var6.tests b/shell/ash_test/ash-vars/var6.tests
new file mode 100755
index 0000000..626e60e
--- /dev/null
+++ b/shell/ash_test/ash-vars/var6.tests
@@ -0,0 +1,5 @@
+# reject invalid vars
+# (set argv0 to "SHELL" to avoid "/path/to/shell: blah" in error messages)
+"$THIS_SH" -c 'echo ${1q}' SHELL
+"$THIS_SH" -c 'echo ${&}' SHELL
+#"$THIS_SH" -c 'echo ${$}' SHELL -- this is valid as it's the same as $$
diff --git a/shell/ash_test/ash-vars/var_nested1.right b/shell/ash_test/ash-vars/var_nested1.right
new file mode 100644
index 0000000..f4bc5f4
--- /dev/null
+++ b/shell/ash_test/ash-vars/var_nested1.right
@@ -0,0 +1,3 @@
+Expected:AB Actual:AB
+Expected:Ab Actual:Ab
+Expected:ab Actual:ab
diff --git a/shell/ash_test/ash-vars/var_nested1.tests b/shell/ash_test/ash-vars/var_nested1.tests
new file mode 100755
index 0000000..59e4a14
--- /dev/null
+++ b/shell/ash_test/ash-vars/var_nested1.tests
@@ -0,0 +1,16 @@
+f() { a=A; b=B; }
+
+a=a
+b=b
+f
+echo Expected:AB Actual:$a$b
+
+a=a
+b=b
+b= f
+echo Expected:Ab Actual:$a$b
+
+a=a
+b=b
+a= b= f
+echo Expected:ab Actual:$a$b
diff --git a/shell/ash_test/ash-vars/var_nested2.right b/shell/ash_test/ash-vars/var_nested2.right
new file mode 100644
index 0000000..c930d97
--- /dev/null
+++ b/shell/ash_test/ash-vars/var_nested2.right
@@ -0,0 +1 @@
+aB
diff --git a/shell/ash_test/ash-vars/var_nested2.tests b/shell/ash_test/ash-vars/var_nested2.tests
new file mode 100755
index 0000000..e886586
--- /dev/null
+++ b/shell/ash_test/ash-vars/var_nested2.tests
@@ -0,0 +1,2 @@
+# the bug was easier to trigger in one-liner form
+a=a; b=b; f() { a=A; b=B; }; a= f; echo $a$b
diff --git a/shell/hush_test/hush-vars/var6.tests b/shell/hush_test/hush-vars/var6.tests
index aea36d6..626e60e 100755
--- a/shell/hush_test/hush-vars/var6.tests
+++ b/shell/hush_test/hush-vars/var6.tests
@@ -1,4 +1,5 @@
# reject invalid vars
-"$THIS_SH" -c 'echo ${1q}'
-"$THIS_SH" -c 'echo ${&}'
-#"$THIS_SH" -c 'echo ${$}' -- this is valid as it's the same as $$
+# (set argv0 to "SHELL" to avoid "/path/to/shell: blah" in error messages)
+"$THIS_SH" -c 'echo ${1q}' SHELL
+"$THIS_SH" -c 'echo ${&}' SHELL
+#"$THIS_SH" -c 'echo ${$}' SHELL -- this is valid as it's the same as $$