summary refs log tree commit diff
path: root/Test
diff options
context:
space:
mode:
authorPeter Stephenson <pws@zsh.org>2015-07-09 14:58:10 +0100
committerPeter Stephenson <pws@zsh.org>2015-07-09 14:59:20 +0100
commit3af55c858f12fe72eebd6addca89bf6395cae826 (patch)
tree4bc95951b8f0785a62f94797bcafa7001b38c51c /Test
parente402747dd6450cafaf1ca6c01671a5adf1595d02 (diff)
downloadzsh-3af55c858f12fe72eebd6addca89bf6395cae826.tar.gz
zsh-3af55c858f12fe72eebd6addca89bf6395cae826.tar.xz
zsh-3af55c858f12fe72eebd6addca89bf6395cae826.zip
35751: Fix ERR_RETURN and ERR_EXIT in "else"
Diffstat (limited to 'Test')
-rw-r--r--Test/C03traps.ztst40
1 files changed, 40 insertions, 0 deletions
diff --git a/Test/C03traps.ztst b/Test/C03traps.ztst
index 757f75ca4..4e2338825 100644
--- a/Test/C03traps.ztst
+++ b/Test/C03traps.ztst
@@ -399,6 +399,46 @@
    )
 1:ERREXIT in loop with simple commands
 
+  fn() {
+    emulate -L zsh
+    setopt errreturn
+    if false; then
+      false
+      print No.
+    else
+      print Oh, yes
+    fi
+  }
+  fn
+0:ERRRETURN not triggered in if condition
+>Oh, yes
+
+  fn() {
+    emulate -L zsh
+    setopt errreturn
+    if true; then
+      false
+      print No.
+    else
+      print No, no.
+    fi
+  }
+  fn
+1:ERRRETURN in "if"
+
+  fn() {
+    emulate -L zsh
+    setopt errreturn
+    if false; then
+      print No.
+    else
+      false
+      print No, no.
+    fi
+  }
+  fn
+1:ERRRETURN in "else" branch (regression test)
+
 %clean
 
   rm -f TRAPEXIT