summary refs log tree commit diff
path: root/Test
diff options
context:
space:
mode:
authorPeter Stephenson <p.stephenson@samsung.com>2018-07-09 11:06:07 +0100
committerPeter Stephenson <p.stephenson@samsung.com>2018-07-09 11:07:53 +0100
commit17178db1a4d8700c9e10862d0dd496f92c53f1cd (patch)
tree8081ecb3dcd951f77ed4b4bbbc63eddd76b51190 /Test
parent8cb4fc00c29594aa6c497020b8ff5f7a4d4dd7ea (diff)
downloadzsh-17178db1a4d8700c9e10862d0dd496f92c53f1cd.tar.gz
zsh-17178db1a4d8700c9e10862d0dd496f92c53f1cd.tar.xz
zsh-17178db1a4d8700c9e10862d0dd496f92c53f1cd.zip
users/23531: Error exit/return fixes.
Fix regression with trap on left hand side of pipe.

Fix forced return from shell structure within nested function.

Fix tests exiting too early.

Add new test case.
Diffstat (limited to 'Test')
-rw-r--r--Test/C03traps.ztst17
1 files changed, 17 insertions, 0 deletions
diff --git a/Test/C03traps.ztst b/Test/C03traps.ztst
index f22962550..dce263f94 100644
--- a/Test/C03traps.ztst
+++ b/Test/C03traps.ztst
@@ -680,6 +680,22 @@ F:Must be tested with a top-level script rather than source or function
 >Better
 >In .zshenv
 
+  unsetopt errreturn
+  fn2() {
+    if true; then
+      false
+    fi
+  }
+  fn1() {
+    setopt localoptions errreturn
+    fn2
+    print $?
+  }
+  fn1
+  print fn1 done
+0:ERR_RETURN caused by function returning false from within shell construct
+>fn1 done
+
   fn2() {
     if false; then
       print Bad
@@ -741,6 +757,7 @@ 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
 
+  unsetopt err_exit err_return
   (setopt err_exit
   for x in y; do
     false