From b5198b10a1d1b6a15c583eecf12fda0c08b19ad6 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Fri, 13 Jun 2014 21:39:44 +0100 Subject: 32768 with further modifications: LOCAL_LOOPS option. --- Test/E01options.ztst | 44 +++++++++++++++++++++++++++++++++++++++++++- Test/ztst.zsh | 6 +++++- 2 files changed, 48 insertions(+), 2 deletions(-) (limited to 'Test') diff --git a/Test/E01options.ztst b/Test/E01options.ztst index d9f219115..46b183776 100644 --- a/Test/E01options.ztst +++ b/Test/E01options.ztst @@ -430,7 +430,7 @@ foo unfunction foo 0:FUNCTION_ARGZERO option ->My name is ZTST_execchunk +>My name is (anon) >My name is foo setopt _NO_glob_ @@ -1114,3 +1114,45 @@ >1 >1 >2 + + for (( i = 0; i < 10; i++ )); do + () { + print $i + break + } + done +0:NO_LOCAL_LOOPS +>0 + + () { + emulate -L zsh + setopt localloops + for (( i = 0; i < 10; i++ )); do + () { + setopt nolocalloops # ignored in parent + print $i + break + } + done + } +0:LOCAL_LOOPS +>0 +>1 +>2 +>3 +>4 +>5 +>6 +>7 +>8 +>9 +?(anon):4: `break' active at end of function scope +?(anon):4: `break' active at end of function scope +?(anon):4: `break' active at end of function scope +?(anon):4: `break' active at end of function scope +?(anon):4: `break' active at end of function scope +?(anon):4: `break' active at end of function scope +?(anon):4: `break' active at end of function scope +?(anon):4: `break' active at end of function scope +?(anon):4: `break' active at end of function scope +?(anon):4: `break' active at end of function scope diff --git a/Test/ztst.zsh b/Test/ztst.zsh index 745a13cff..74111f6cc 100755 --- a/Test/ztst.zsh +++ b/Test/ztst.zsh @@ -260,8 +260,12 @@ $ZTST_redir" # Execute an indented chunk. Redirections will already have # been set up, but we need to handle the options. ZTST_execchunk() { + setopt localloops # don't let continue & break propagate out options=($ZTST_testopts) - eval "$ZTST_code" + () { + unsetopt localloops + eval "$ZTST_code" + } ZTST_status=$? # careful... ksh_arrays may be in effect. ZTST_testopts=(${(kv)options[*]}) -- cgit 1.4.1