Add regression tests for eval

This commit is contained in:
Mahmoud Al-Qudsi 2019-04-13 17:17:57 -05:00
parent 05f52924c1
commit 2dfc85245f
6 changed files with 61 additions and 4 deletions

13
tests/eval.err Normal file
View file

@ -0,0 +1,13 @@
####################
# Testing eval builtin
fish: Unexpected end of string, expecting ')'
(
^
fish: The expanded command was empty.
""
^
####################
# Testing eval with empty functions, blocks, and arguments

33
tests/eval.in Normal file
View file

@ -0,0 +1,33 @@
logmsg "Testing eval builtin"
# Regression test for issue #4443
eval set -l previously_undefined foo
echo $previously_undefined
# Test redirection
eval "echo you can\\'t see this 1>&2" 2>/dev/null
# Test return statuses
false; eval true; echo $status # 0
false; eval false; echo $status # 1
# Test return status in case of parsing error
false; eval "("; echo $status # 1
false; eval '""'; echo $status # 1
function empty
end
# Regression tests for issue #5692
logmsg "Testing eval with empty functions, blocks, and arguments"
false; eval;
echo blank eval: $status # 0
false; eval "";
echo empty arg eval: $status # 0
false; eval empty;
echo empty function eval $status # 0
false; eval "begin; end;";
echo empty block eval: $status # 0

15
tests/eval.out Normal file
View file

@ -0,0 +1,15 @@
####################
# Testing eval builtin
foo
0
1
1
1
####################
# Testing eval with empty functions, blocks, and arguments
blank eval: 0
empty arg eval: 0
empty function eval 0
empty block eval: 0

View file

View file

@ -1,3 +0,0 @@
# Regression test for issue #4443
eval set -l previously_undefined foo
echo $previously_undefined

View file

@ -1 +0,0 @@
foo