about summary refs log tree commit diff
path: root/Test/C03traps.ztst
diff options
context:
space:
mode:
authorPhilippe Altherr <philippe.altherr@gmail.com>2022-12-03 20:44:10 -0800
committerBart Schaefer <schaefer@zsh.org>2022-12-03 20:44:10 -0800
commitdd3ba3d5991f5c99334742147fb2213b8c400a42 (patch)
treebc05729239d27ea7d91970ee6e76948fe691d1ed /Test/C03traps.ztst
parentd47b8480f0eb883d54fcbef22999bf26d13d56a4 (diff)
downloadzsh-dd3ba3d5991f5c99334742147fb2213b8c400a42.tar.gz
zsh-dd3ba3d5991f5c99334742147fb2213b8c400a42.tar.xz
zsh-dd3ba3d5991f5c99334742147fb2213b8c400a42.zip
51001: fix for ERR_EXIT following shell function; update tests
Diffstat (limited to 'Test/C03traps.ztst')
-rw-r--r--Test/C03traps.ztst82
1 files changed, 82 insertions, 0 deletions
diff --git a/Test/C03traps.ztst b/Test/C03traps.ztst
index 08e24a32e..a8880673f 100644
--- a/Test/C03traps.ztst
+++ b/Test/C03traps.ztst
@@ -743,6 +743,15 @@ F:Must be tested with a top-level script rather than source or function
 >OK
 
   (setopt err_exit
+  fn() {
+    false && true
+  }
+  fn
+  print OK
+  )
+1:ERR_EXIT not triggered by "false && true" but by return from fn
+
+  (setopt err_exit
   for x in y; do
     false && true
   done
@@ -752,6 +761,17 @@ F:Must be tested with a top-level script rather than source or function
 >OK
 
   (setopt err_exit
+  fn() {
+    for x in y; do
+      false && true
+    done
+  }
+  fn
+  print OK
+  )
+1:ERR_EXIT not triggered by status 1 at end of for but by return from fn
+
+  (setopt err_exit
   repeat 1; do
     false && true
   done
@@ -761,6 +781,17 @@ F:Must be tested with a top-level script rather than source or function
 >OK
 
   (setopt err_exit
+  fn() {
+    repeat 1; do
+      false && true
+    done
+  }
+  fn
+  print OK
+  )
+1:ERR_EXIT not triggered by status 1 at end of repeat but by return from fn
+
+  (setopt err_exit
   if true; then
     false && true
   fi
@@ -770,6 +801,17 @@ F:Must be tested with a top-level script rather than source or function
 >OK
 
   (setopt err_exit
+  fn() {
+    if true; then
+      false && true
+    fi
+  }
+  fn
+  print OK
+  )
+1:ERR_EXIT not triggered by status 1 at end of if but by return from fn
+
+  (setopt err_exit
   loop=true
   while print COND; $loop; do
     loop=false
@@ -783,6 +825,21 @@ F:Must be tested with a top-level script rather than source or function
 >OK
 
   (setopt err_exit
+  fn() {
+    loop=true
+    while print COND; $loop; do
+      loop=false
+      false && true
+    done
+  }
+  fn
+  print OK
+  )
+1:ERR_EXIT not triggered by status 1 at end of while but by return from fn
+>COND
+>COND
+
+  (setopt err_exit
   {
     false && true
   } always {
@@ -795,6 +852,20 @@ F:Must be tested with a top-level script rather than source or function
 >OK
 
   (setopt err_exit
+  fn() {
+    {
+      false && true
+    } always {
+      print ALWAYS
+    }
+  }
+  fn
+  print OK
+  )
+1:ERR_EXIT not triggered by status 1 at end of always but by return from fn
+>ALWAYS
+
+  (setopt err_exit
   {
     false && true
   }
@@ -803,6 +874,17 @@ F:Must be tested with a top-level script rather than source or function
 0:ERR_EXIT not triggered by status 1 at end of { }
 >OK
 
+  (setopt err_exit
+  fn() {
+    {
+      false && true
+    }
+  }
+  fn
+  print OK
+  )
+1:ERR_EXIT not triggered by status 1 at end of { } but by return from fn
+
   unsetopt err_exit err_return
   (setopt err_exit
   for x in y; do