Skip to content

Commit

Permalink
51001: fix for ERR_EXIT with "always" blocks; update tests
Browse files Browse the repository at this point in the history
paltherr authored and bartschaefer committed Dec 4, 2022
1 parent 23dc19f commit fda6fd9
Showing 2 changed files with 30 additions and 7 deletions.
1 change: 1 addition & 0 deletions Src/loop.c
Original file line number Diff line number Diff line change
@@ -793,6 +793,7 @@ exectry(Estate state, int do_exec)
cmdpop();
popheap();
state->pc = end;
this_noerrexit = 1;

return endval;
}
36 changes: 29 additions & 7 deletions Test/C03traps.ztst
Original file line number Diff line number Diff line change
@@ -721,22 +721,19 @@ F:Must be tested with a top-level script rather than source or function
>Good

(setopt err_exit
for x in y; do
false && true
done
false && true
print OK
)
0:ERR_EXIT not triggered by status 1 at end of for
0:ERR_EXIT not triggered by "false && true"
>OK

(setopt err_exit
integer x=0
while (( ! x++ )); do
for x in y; do
false && true
done
print OK
)
0:ERR_EXIT not triggered by status 1 at end of while
0:ERR_EXIT not triggered by status 1 at end of for
>OK

(setopt err_exit
@@ -755,6 +752,31 @@ F:Must be tested with a top-level script rather than source or function
print OK
)
0:ERR_EXIT not triggered by status 1 at end of if
>OK

(setopt err_exit
loop=true
while print COND; $loop; do
loop=false
false && true
done
print OK
)
0:ERR_EXIT not triggered by status 1 at end of while
>COND
>COND
>OK

(setopt err_exit
{
false && true
} always {
print ALWAYS
}
print OK
)
0:ERR_EXIT not triggered by status 1 at end of always
>ALWAYS
>OK

(setopt err_exit

0 comments on commit fda6fd9

Please sign in to comment.