shell: update psubst testcases
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
8dd676c6c3
commit
c450437a4e
24
shell/ash_test/ash-psubst/falsetick.right
Normal file
24
shell/ash_test/ash-psubst/falsetick.right
Normal file
@ -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
|
19
shell/ash_test/ash-psubst/falsetick.tests
Executable file
19
shell/ash_test/ash-psubst/falsetick.tests
Executable file
@ -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 $?
|
1
shell/ash_test/ash-psubst/falsetick2.right
Normal file
1
shell/ash_test/ash-psubst/falsetick2.right
Normal file
@ -0,0 +1 @@
|
||||
Two:2 v:[]
|
3
shell/ash_test/ash-psubst/falsetick2.tests
Executable file
3
shell/ash_test/ash-psubst/falsetick2.tests
Executable file
@ -0,0 +1,3 @@
|
||||
v=v
|
||||
v=`exit 2` `false`
|
||||
echo Two:$? v:"[$v]"
|
@ -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
|
||||
|
@ -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"
|
||||
|
3
shell/hush_test/hush-psubst/falsetick3.right
Normal file
3
shell/hush_test/hush-psubst/falsetick3.right
Normal file
@ -0,0 +1,3 @@
|
||||
hush: can't open '/does/not/exist': No such file or directory
|
||||
1
|
||||
Done: a=b
|
3
shell/hush_test/hush-psubst/falsetick3.tests
Executable file
3
shell/hush_test/hush-psubst/falsetick3.tests
Executable file
@ -0,0 +1,3 @@
|
||||
# assignment still happens despite redirect error
|
||||
true; a=$(echo b) >/does/not/exist; echo $?
|
||||
echo "Done: a=$a"
|
Loading…
Reference in New Issue
Block a user