From 47a61a32029e558dc7c557a92995079da86ccf94 Mon Sep 17 00:00:00 2001 From: Mahmoud Al-Qudsi Date: Sat, 13 Apr 2019 12:11:42 -0500 Subject: [PATCH] Test: validate $status is preserved on calling into a function --- tests/status.err | 3 +++ tests/status.in | 7 +++++++ tests/status.out | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/tests/status.err b/tests/status.err index 87e63a330..ad52d81c6 100644 --- a/tests/status.err +++ b/tests/status.err @@ -7,3 +7,6 @@ status: Invalid job control mode '1none' #################### # Future Feature Flags + +#################### +# Ensure $status isn't reset before a function is executed diff --git a/tests/status.in b/tests/status.in index 9f33badd6..ad68a9231 100644 --- a/tests/status.in +++ b/tests/status.in @@ -48,3 +48,10 @@ logmsg Future Feature Flags status features status test-feature stderr-nocaret ; echo $status status test-feature not-a-feature ; echo $status + +logmsg 'Ensure $status isn\'t reset before a function is executed' +function echo_last + echo $status +end + +false; echo_last; echo $status #1 diff --git a/tests/status.out b/tests/status.out index 283b13030..b5cb078c0 100644 --- a/tests/status.out +++ b/tests/status.out @@ -9,3 +9,8 @@ qmark-noglob off 3.0 ? no longer globs string-replace-fewer-backslashes off 3.1 string replace -r needs fewer backslashes in the replacement 1 2 + +#################### +# Ensure $status isn't reset before a function is executed +1 +0