about summary refs log tree commit diff
path: root/Test
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2001-10-01 12:38:32 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2001-10-01 12:38:32 +0000
commit89719fbac345ea6699d6fd6b5d07dc5d4ec28ea6 (patch)
tree009713df92ca6515f418c285a566d4df52879345 /Test
parent1d97597697ca9b74688844d05aa8e39d51610c95 (diff)
downloadzsh-89719fbac345ea6699d6fd6b5d07dc5d4ec28ea6.tar.gz
zsh-89719fbac345ea6699d6fd6b5d07dc5d4ec28ea6.tar.xz
zsh-89719fbac345ea6699d6fd6b5d07dc5d4ec28ea6.zip
test EXIT trap fix
Diffstat (limited to 'Test')
-rw-r--r--Test/C03traps.ztst12
1 files changed, 12 insertions, 0 deletions
diff --git a/Test/C03traps.ztst b/Test/C03traps.ztst
index f898a379e..81ef38a30 100644
--- a/Test/C03traps.ztst
+++ b/Test/C03traps.ztst
@@ -45,6 +45,18 @@
 0:Nested `trap - EXIT' on `TRAPEXIT'
 >EXIT1
 
+# We can't test an EXIT trap for the shell as a whole, because
+# we're inside a function scope which we don't leave when the
+# subshell exits.  Not sure if that's the correct behaviour, but
+# it's sort of consistent.
+  ( fn1() { trap 'print Function 1 going' EXIT; exit; print Not reached; }
+    fn2() { trap 'print Function 2 going' EXIT; fn1; print Not reached; }
+    fn2
+  )
+0:EXIT traps on functions when exiting from function
+>Function 1 going
+>Function 2 going
+
   fn1() {
     trap
     trap 'print INT1' INT