summaryrefslogtreecommitdiff
path: root/shell/ash_test/ash-psubst
diff options
context:
space:
mode:
authorDenys Vlasenko2021-07-27 04:20:32 +0200
committerDenys Vlasenko2021-07-27 04:20:32 +0200
commitc450437a4e631378cd6a2dc06a5923ce811a950d (patch)
tree448ad0b6599a5365dedd8f78960957a722c0aecb /shell/ash_test/ash-psubst
parent8dd676c6c3b862846a4a215f5f3a8822fcf8c569 (diff)
downloadbusybox-c450437a4e631378cd6a2dc06a5923ce811a950d.zip
busybox-c450437a4e631378cd6a2dc06a5923ce811a950d.tar.gz
shell: update psubst testcases
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell/ash_test/ash-psubst')
-rw-r--r--shell/ash_test/ash-psubst/falsetick.right24
-rwxr-xr-xshell/ash_test/ash-psubst/falsetick.tests19
-rw-r--r--shell/ash_test/ash-psubst/falsetick2.right1
-rwxr-xr-xshell/ash_test/ash-psubst/falsetick2.tests3
4 files changed, 47 insertions, 0 deletions
diff --git a/shell/ash_test/ash-psubst/falsetick.right b/shell/ash_test/ash-psubst/falsetick.right
new file mode 100644
index 0000000..0335254
--- /dev/null
+++ b/shell/ash_test/ash-psubst/falsetick.right
@@ -0,0 +1,24 @@
+0
+0
+0
+0
+2
+2
+2
+2
+./falsetick.tests: line 12: can't create /does/not/exist: nonexistent directory
+1
+./falsetick.tests: line 13: can't create /does/not/exist: nonexistent directory
+1
+./falsetick.tests: line 14: can't create /does/not/exist: nonexistent directory
+1
+./falsetick.tests: line 15: can't create /does/not/exist: nonexistent directory
+1
+./falsetick.tests: line 16: can't create /does/not/exist: nonexistent directory
+1
+./falsetick.tests: line 17: can't create /does/not/exist: nonexistent directory
+1
+./falsetick.tests: line 18: can't create /does/not/exist: nonexistent directory
+1
+./falsetick.tests: line 19: can't create /does/not/exist: nonexistent directory
+1
diff --git a/shell/ash_test/ash-psubst/falsetick.tests b/shell/ash_test/ash-psubst/falsetick.tests
new file mode 100755
index 0000000..d2b9369
--- /dev/null
+++ b/shell/ash_test/ash-psubst/falsetick.tests
@@ -0,0 +1,19 @@
+# Exitcode 0 (`` has no exitcode, but assignment has):
+true; a=``; echo $?
+false; a=``; echo $?
+true; a=$(); echo $?
+false; a=$(); echo $?
+# Exitcode 2 (`cmd` expansion sets exitcode after assignment set it to 0):
+true; a=`exit 2`; echo $?
+false; a=`exit 2`; echo $?
+true; a=$(exit 2); echo $?
+false; a=$(exit 2); echo $?
+# Exitcode 1 (redirect sets exitcode to 1 on error after them):
+true; a=`` >/does/not/exist; echo $?
+false; a=`` >/does/not/exist; echo $?
+true; a=$() >/does/not/exist; echo $?
+false; a=$() >/does/not/exist; echo $?
+true; a=`exit 2` >/does/not/exist; echo $?
+false; a=`exit 2` >/does/not/exist; echo $?
+true; a=$(exit 2) >/does/not/exist; echo $?
+false; a=$(exit 2) >/does/not/exist; echo $?
diff --git a/shell/ash_test/ash-psubst/falsetick2.right b/shell/ash_test/ash-psubst/falsetick2.right
new file mode 100644
index 0000000..670f560
--- /dev/null
+++ b/shell/ash_test/ash-psubst/falsetick2.right
@@ -0,0 +1 @@
+Two:2 v:[]
diff --git a/shell/ash_test/ash-psubst/falsetick2.tests b/shell/ash_test/ash-psubst/falsetick2.tests
new file mode 100755
index 0000000..cfbd1a5
--- /dev/null
+++ b/shell/ash_test/ash-psubst/falsetick2.tests
@@ -0,0 +1,3 @@
+v=v
+v=`exit 2` `false`
+echo Two:$? v:"[$v]"