From ab37dfaf7832d0be6bf9d47e892baf4635c14412 Mon Sep 17 00:00:00 2001 From: Mahmoud Al-Qudsi Date: Fri, 12 Apr 2019 07:58:55 -0500 Subject: [PATCH] Add tests for evaluaton of empty blocks and functions --- tests/empty.err | 3 +++ tests/empty.in | 16 ++++++++++++++++ tests/empty.out | 7 +++++++ 3 files changed, 26 insertions(+) create mode 100644 tests/empty.err create mode 100644 tests/empty.in create mode 100644 tests/empty.out 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