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
