From c450437a4e631378cd6a2dc06a5923ce811a950d Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Tue, 27 Jul 2021 04:20:32 +0200 Subject: shell: update psubst testcases Signed-off-by: Denys Vlasenko --- shell/ash_test/ash-psubst/falsetick.right | 24 ++++++++++++++++++++++++ shell/ash_test/ash-psubst/falsetick.tests | 19 +++++++++++++++++++ shell/ash_test/ash-psubst/falsetick2.right | 1 + shell/ash_test/ash-psubst/falsetick2.tests | 3 +++ 4 files changed, 47 insertions(+) create mode 100644 shell/ash_test/ash-psubst/falsetick.right create mode 100755 shell/ash_test/ash-psubst/falsetick.tests create mode 100644 shell/ash_test/ash-psubst/falsetick2.right create mode 100755 shell/ash_test/ash-psubst/falsetick2.tests (limited to 'shell/ash_test') 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]" -- cgit v1.1