about summary refs log tree commit diff
path: root/Test
diff options
context:
space:
mode:
authorPeter Stephenson <p.stephenson@samsung.com>2023-04-17 09:30:34 +0100
committerPeter Stephenson <p.stephenson@samsung.com>2023-04-17 09:30:34 +0100
commit8f5fe841a63fecdab4416578653549689f2c592f (patch)
tree3d4385680711236021e38f2705c1e01baa65a46d /Test
parentd6e69b72990f42549fbe8fc54dd7edd14bc66701 (diff)
downloadzsh-8f5fe841a63fecdab4416578653549689f2c592f.tar.gz
zsh-8f5fe841a63fecdab4416578653549689f2c592f.tar.xz
zsh-8f5fe841a63fecdab4416578653549689f2c592f.zip
51652: fix running of TRAPEXIT explicitly.
This is a special case where TRAPEXIT is unset within a TRAPEXIT
as it should never run in a nested context, so just save the
function structure temporarily on the heap.
Diffstat (limited to 'Test')
-rw-r--r--Test/C03traps.ztst11
1 files changed, 11 insertions, 0 deletions
diff --git a/Test/C03traps.ztst b/Test/C03traps.ztst
index e0b6afb5f..de57765a0 100644
--- a/Test/C03traps.ztst
+++ b/Test/C03traps.ztst
@@ -1083,6 +1083,17 @@ F:Must be tested with a top-level script rather than source or function
 >trap1
 # As of 5.7.1-test-2, the output was "out1 fn1 trap1 fn2" (on separate lines).
 
+  TRAPEXIT() { echo This is TRAPEXIT; }
+  TRAPEXIT
+  TRAPEXIT
+  TRAPEXIT
+0:No memory problems with explicit call to TRAPEXIT.
+>This is TRAPEXIT
+>This is TRAPEXIT
+>This is TRAPEXIT
+>This is TRAPEXIT
+# Three explicit calls, one implicit call at function exit.
+
 %clean
 
   rm -f TRAPEXIT