about summary refs log tree commit diff
path: root/Test
diff options
context:
space:
mode:
authorPeter Stephenson <p.w.stephenson@ntlworld.com>2017-08-27 20:28:38 +0100
committerPeter Stephenson <p.w.stephenson@ntlworld.com>2017-08-29 19:52:18 +0100
commit7d1877da4e6fabde8f0b5eb2f9a9f03d83e6c28d (patch)
tree04cd41bdb22033f01fbd04f6e6b691a15f400108 /Test
parent8b4d2329c71377fcab7d73bc0656094557c720a9 (diff)
downloadzsh-7d1877da4e6fabde8f0b5eb2f9a9f03d83e6c28d.tar.gz
zsh-7d1877da4e6fabde8f0b5eb2f9a9f03d83e6c28d.tar.xz
zsh-7d1877da4e6fabde8f0b5eb2f9a9f03d83e6c28d.zip
41608 (plus tests): restore ERR_EXIT before function.
There was an exception to the usual ERR_EXIT pattern that causes
problems when executing a function in an else branch.  It seems
the exception is no longer needed as the regression tests pass
without it.
Diffstat (limited to 'Test')
-rw-r--r--Test/C03traps.ztst35
1 files changed, 35 insertions, 0 deletions
diff --git a/Test/C03traps.ztst b/Test/C03traps.ztst
index 759401225..f8a12319a 100644
--- a/Test/C03traps.ztst
+++ b/Test/C03traps.ztst
@@ -465,6 +465,41 @@
    )
 1:ERREXIT in loop with simple commands
 
+  (set -e
+  f()
+  {
+    false && false
+  }
+  if false; then
+    :
+  else
+    # ERR_EXIT should trigger on return from function, not in function.
+    f
+    echo Fail 1
+    echo Fail 2
+    f
+    echo Fail 3
+  fi)
+1:ERREXIT with false from inside && within function
+
+  (set -e
+  f()
+  {
+  }
+  if false; then
+    :
+  else
+    f
+    echo Succeed 1
+    echo Succeed 2
+    f
+    echo Succeed 3
+  fi)
+0:ERREXIT not triggered on empty function after false in if.
+>Succeed 1
+>Succeed 2
+>Succeed 3
+
   fn() {
     emulate -L zsh
     setopt errreturn