2012-06-22 10:09:45 +08:00
|
|
|
# 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
|
2012-07-10 21:32:37 +08:00
|
|
|
|
|
|
|
#test contains -i
|
|
|
|
echo test contains -i
|
|
|
|
contains -i string a b c string d
|
|
|
|
contains -i string a b c d; or echo nothing
|
|
|
|
contains -i -- string a b c string d
|
|
|
|
contains -i -- -- a b c; or echo nothing
|
|
|
|
contains -i -- -- a b c -- v
|