diff options
author | Denys Vlasenko | 2021-07-27 04:20:32 +0200 |
---|---|---|
committer | Denys Vlasenko | 2021-07-27 04:20:32 +0200 |
commit | c450437a4e631378cd6a2dc06a5923ce811a950d (patch) | |
tree | 448ad0b6599a5365dedd8f78960957a722c0aecb | |
parent | 8dd676c6c3b862846a4a215f5f3a8822fcf8c569 (diff) | |
download | busybox-c450437a4e631378cd6a2dc06a5923ce811a950d.zip busybox-c450437a4e631378cd6a2dc06a5923ce811a950d.tar.gz |
shell: update psubst testcases
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | shell/ash_test/ash-psubst/falsetick.right | 24 | ||||
-rwxr-xr-x | shell/ash_test/ash-psubst/falsetick.tests | 19 | ||||
-rw-r--r-- | shell/ash_test/ash-psubst/falsetick2.right | 1 | ||||
-rwxr-xr-x | shell/ash_test/ash-psubst/falsetick2.tests | 3 | ||||
-rw-r--r-- | shell/hush_test/hush-psubst/falsetick.right | 3 | ||||
-rwxr-xr-x | shell/hush_test/hush-psubst/falsetick.tests | 3 | ||||
-rw-r--r-- | shell/hush_test/hush-psubst/falsetick3.right | 3 | ||||
-rwxr-xr-x | shell/hush_test/hush-psubst/falsetick3.tests | 3 |
8 files changed, 53 insertions, 6 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]" diff --git a/shell/hush_test/hush-psubst/falsetick.right b/shell/hush_test/hush-psubst/falsetick.right index 0b98fb7..d2d1a28 100644 --- a/shell/hush_test/hush-psubst/falsetick.right +++ b/shell/hush_test/hush-psubst/falsetick.right @@ -22,6 +22,3 @@ hush: can't open '/does/not/exist': No such file or directory 1 hush: can't open '/does/not/exist': No such file or directory 1 -hush: can't open '/does/not/exist': No such file or directory -1 -Done: a=b diff --git a/shell/hush_test/hush-psubst/falsetick.tests b/shell/hush_test/hush-psubst/falsetick.tests index 44d2eae..d2b9369 100755 --- a/shell/hush_test/hush-psubst/falsetick.tests +++ b/shell/hush_test/hush-psubst/falsetick.tests @@ -17,6 +17,3 @@ 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 $? -# ...and assignment still happens despite redirect error: -true; a=$(echo b) >/does/not/exist; echo $? -echo "Done: a=$a" diff --git a/shell/hush_test/hush-psubst/falsetick3.right b/shell/hush_test/hush-psubst/falsetick3.right new file mode 100644 index 0000000..327849a --- /dev/null +++ b/shell/hush_test/hush-psubst/falsetick3.right @@ -0,0 +1,3 @@ +hush: can't open '/does/not/exist': No such file or directory +1 +Done: a=b diff --git a/shell/hush_test/hush-psubst/falsetick3.tests b/shell/hush_test/hush-psubst/falsetick3.tests new file mode 100755 index 0000000..cd18533 --- /dev/null +++ b/shell/hush_test/hush-psubst/falsetick3.tests @@ -0,0 +1,3 @@ +# assignment still happens despite redirect error +true; a=$(echo b) >/does/not/exist; echo $? +echo "Done: a=$a" |