aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/test7.in
diff options
context:
space:
mode:
authorGravatar Kevin Ballard <kevin@sb.org>2012-06-21 19:09:45 -0700
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-06-24 13:43:44 -0700
commitf7d0c4b065cb6a282a5e3d164bdcc5fc4a7e8b8e (patch)
tree7f5a8172d2c9da4f3c0e33bd068832213412c546 /tests/test7.in
parent5fb32f1e2d399844b3432fe4baa6183de0d65307 (diff)
Add a test case for switch error code (issue #161)
Diffstat (limited to 'tests/test7.in')
-rw-r--r--tests/test7.in30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/test7.in b/tests/test7.in
new file mode 100644
index 00000000..1ad65648
--- /dev/null
+++ b/tests/test7.in
@@ -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