Add a test case for switch error code (issue #161)

This commit is contained in:
Kevin Ballard 2012-06-21 19:09:45 -07:00 committed by ridiculousfish
parent 5fb32f1e2d
commit f7d0c4b065
5 changed files with 40 additions and 0 deletions

0
tests/test7.err Normal file
View file

30
tests/test7.in Normal file
View 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
View file

@ -0,0 +1,7 @@
1
2
3
0
1
1

1
tests/test7.status Normal file
View file

@ -0,0 +1 @@
0

View file

@ -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