mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 05:13:10 +00:00
Add tests for $status
after while
in various scenarios
Includes a regression test for #5513 and asserts the behavior defined in \#4982.
This commit is contained in:
parent
027fc43736
commit
03cdf89bfd
3 changed files with 30 additions and 0 deletions
0
tests/while.err
Normal file
0
tests/while.err
Normal file
27
tests/while.in
Normal file
27
tests/while.in
Normal file
|
@ -0,0 +1,27 @@
|
|||
# vim: set ft=fish:
|
||||
|
||||
function never_runs
|
||||
while false
|
||||
end
|
||||
end
|
||||
|
||||
function early_return
|
||||
while true
|
||||
return 2
|
||||
end
|
||||
end
|
||||
|
||||
function runs_once
|
||||
set -l i 1
|
||||
while test $i -ne 0 && set i (math $i - 1)
|
||||
end
|
||||
end
|
||||
|
||||
# this should return 1
|
||||
never_runs; echo $status
|
||||
|
||||
# this should return 0
|
||||
runs_once; echo $status
|
||||
|
||||
# this should return 2
|
||||
early_return; echo $status
|
3
tests/while.out
Normal file
3
tests/while.out
Normal file
|
@ -0,0 +1,3 @@
|
|||
1
|
||||
0
|
||||
2
|
Loading…
Reference in a new issue