summaryrefslogtreecommitdiff
path: root/Test
diff options
context:
space:
mode:
authorPeter Stephenson <p.w.stephenson@ntlworld.com>2014-06-13 21:39:44 +0100
committerPeter Stephenson <p.w.stephenson@ntlworld.com>2014-06-13 21:39:44 +0100
commitb5198b10a1d1b6a15c583eecf12fda0c08b19ad6 (patch)
tree9f4c71809d8480bfb3e771fdfdd70439c29df50e /Test
parentd6698d89a6ff9e644ee608c1d08ff21911f9fb27 (diff)
downloadzsh-b5198b10a1d1b6a15c583eecf12fda0c08b19ad6.tar.gz
zsh-b5198b10a1d1b6a15c583eecf12fda0c08b19ad6.zip
32768 with further modifications: LOCAL_LOOPS option.
Diffstat (limited to 'Test')
-rw-r--r--Test/E01options.ztst44
-rwxr-xr-xTest/ztst.zsh6
2 files changed, 48 insertions, 2 deletions
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[*]})