aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2013-01-31 15:57:08 -0800
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2013-01-31 15:57:08 -0800
commitad8d68dd4390753901b5e1dae4b4c4b44be7fcea (patch)
tree5b8f5e3ca3d698dd7ae764f2833ab7b91726fd93 /tests
parent0db1b6ce44b2dcae94a4d33c04b606ef819bb78b (diff)
Make subcommands modify $status, and make builtin_set not modify status unless it fails
Diffstat (limited to 'tests')
-rw-r--r--tests/test4.in17
-rw-r--r--tests/test4.out14
2 files changed, 31 insertions, 0 deletions
diff --git a/tests/test4.in b/tests/test4.in
index 5d94ba4a..f207e6b7 100644
--- a/tests/test4.in
+++ b/tests/test4.in
@@ -160,3 +160,20 @@ else
end;
set -U -e baz
+
+echo "Verify subcommand statuses"
+echo (false) $status (true) $status (false) $status
+
+echo "Verify that set passes through exit status, except when passed -n or -q or -e"
+false ; set foo bar ; echo 1 $status # passthrough
+true ; set foo bar ; echo 2 $status # passthrough
+false ; set -q foo ; echo 3 $status # no passthrough
+true ; set -q foo ; echo 4 $status # no passthrough
+false ; set -n > /dev/null ; echo 5 $status # no passthrough
+false ; set -e foo ; echo 6 $status # no passthrough
+true ; set -e foo ; echo 7 $status # no passthrough
+false ; set -h > /dev/null ; echo 8 $status # no passthrough
+true ; set -NOT_AN_OPTION 2> /dev/null ; echo 9 $status # no passthrough
+false ; set foo (echo A; true) ; echo 10 $status $foo
+true ; set foo (echo B; false) ; echo 11 $status $foo
+true
diff --git a/tests/test4.out b/tests/test4.out
index 5a14f80a..148d870c 100644
--- a/tests/test4.out
+++ b/tests/test4.out
@@ -20,3 +20,17 @@ Test 19 pass
Test 20 pass
Test 21 pass
Test 22 pass
+Verify subcommand statuses
+1 0 1
+Verify that set passes through exit status, except when passed -n or -q or -e
+1 1
+2 0
+3 0
+4 0
+5 0
+6 0
+7 1
+8 0
+9 1
+10 0 A
+11 1 B