mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-25 12:23:09 +00:00
Add a test case for switch error code (issue #161)
This commit is contained in:
parent
5fb32f1e2d
commit
f7d0c4b065
5 changed files with 40 additions and 0 deletions
0
tests/test7.err
Normal file
0
tests/test7.err
Normal file
30
tests/test7.in
Normal file
30
tests/test7.in
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
# Test that subsequent cases do not blow away the status from previous ones
|
||||||
|
for val in one two three four
|
||||||
|
switch $val
|
||||||
|
case one
|
||||||
|
/bin/sh -c 'exit 1'
|
||||||
|
case two
|
||||||
|
/bin/sh -c 'exit 2'
|
||||||
|
case three
|
||||||
|
/bin/sh -c 'exit 3'
|
||||||
|
end
|
||||||
|
echo $status
|
||||||
|
end
|
||||||
|
|
||||||
|
echo
|
||||||
|
|
||||||
|
# Test that the `switch` builtin itself does not blow away status before evaluating a case
|
||||||
|
false
|
||||||
|
switch one
|
||||||
|
case one
|
||||||
|
echo $status
|
||||||
|
end
|
||||||
|
|
||||||
|
# Test that non-case tokens inside `switch` don't blow away status
|
||||||
|
# (why are these even allowed?)
|
||||||
|
false
|
||||||
|
switch one
|
||||||
|
true
|
||||||
|
case one
|
||||||
|
echo $status
|
||||||
|
end
|
7
tests/test7.out
Normal file
7
tests/test7.out
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
1
|
||||||
|
2
|
||||||
|
3
|
||||||
|
0
|
||||||
|
|
||||||
|
1
|
||||||
|
1
|
1
tests/test7.status
Normal file
1
tests/test7.status
Normal file
|
@ -0,0 +1 @@
|
||||||
|
0
|
|
@ -4,3 +4,5 @@ File test2.in tested ok
|
||||||
File test3.in tested ok
|
File test3.in tested ok
|
||||||
File test4.in tested ok
|
File test4.in tested ok
|
||||||
File test5.in tested ok
|
File test5.in tested ok
|
||||||
|
File test6.in tested ok
|
||||||
|
File test7.in tested ok
|
||||||
|
|
Loading…
Reference in a new issue