diff options
Diffstat (limited to 'Test/A01grammar.ztst')
-rw-r--r-- | Test/A01grammar.ztst | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/Test/A01grammar.ztst b/Test/A01grammar.ztst index 4e39a8f3c..d57085798 100644 --- a/Test/A01grammar.ztst +++ b/Test/A01grammar.ztst @@ -961,3 +961,60 @@ F:Note that the behaviour of 'exit' inside try-list inside a function is unspeci F:This test was written to ensure the behaviour doesn't change silently. F:If this test fails during development, it *might* be appropriate to change F:its expectations. + + ( + export VALUE=first + print -l 'echo Value is $VALUE' 'VALUE=second sh' 'echo Value is $VALUE' | + $ZTST_testdir/../Src/zsh -f + ) +0:Non-interactive shell command input is line buffered +>Value is first +>Value is second + + fn() { + ! false + } +0:! inverts the status of implicit return + + fn () { + false + ! return + } + fn +1:! does not affect return status of explicit return + + msg=unset + for x in 1 2 3 4 5; do + continue && msg=set && print Not executed + print Not executed, neither. + done + print $msg +0:continue causes immediate continuation +>unset + + msg=unset + () { + return && msg=set && print Not executed + print Not executed, not nor neither. + } + print $msg +0:return causes immediate return +>unset + + msg=unset + for x in 1 2 3 4 5; do + ! continue || msg=set && print Not executed + print Not executed, neither. + done + print $msg +0:! continue causes immediate continuation +>unset + + msg=unset + () { + ! return || msg=set && print Not executed + print Not executed, not nor neither. + } + print $msg +0:! return causes immediate return +>unset |