diff --git a/tests/empty.err b/tests/empty.err new file mode 100644 index 000000000..793c955b5 --- /dev/null +++ b/tests/empty.err @@ -0,0 +1,3 @@ + +#################### +# Testing `0` after empty functions and blocks diff --git a/tests/empty.in b/tests/empty.in new file mode 100644 index 000000000..f27c24850 --- /dev/null +++ b/tests/empty.in @@ -0,0 +1,16 @@ +# See issue 5692 + +logmsg "Testing `$status` after empty functions and blocks" + +function empty +end + +# functions shouldn't preserve $status + +false; empty; echo $status # 0 +true; empty; echo $status # 0 + +# blocks should preserve $status + +false; begin; end; echo $status # 1 +true; begin; end; echo $status # 0 diff --git a/tests/empty.out b/tests/empty.out new file mode 100644 index 000000000..0d0c1d513 --- /dev/null +++ b/tests/empty.out @@ -0,0 +1,7 @@ + +#################### +# Testing `0` after empty functions and blocks +0 +0 +1 +0