mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-22 10:57:30 +08:00
Add a test case for switch error code (issue #161)
This commit is contained in:
parent
5fb32f1e2d
commit
f7d0c4b065
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 test4.in tested ok
|
||||
File test5.in tested ok
|
||||
File test6.in tested ok
|
||||
File test7.in tested ok
|
||||
|
|
Loading…
Reference in New Issue
Block a user