7 unsetopt DEBUG_BEFORE_CMD
10 print "print bug file here" >bug-file
11 print "print this is line one
12 print this is line two
13 print this is line three
14 print and this is line fifty-nine." >bug-file2
15 function debug_trap_handler {
22 trap 'echo EXIT hit' EXIT
23 trap 'debug_trap_handler' DEBUG
27 0: Relationship between traps and sources
39 >and this is line fifty-nine.
46 cat >zsh-trapreturn-bug2 <<-'HERE'
48 [[ -x $cmd ]] && rm $cmd
49 set -o DEBUG_BEFORE_CMD
50 trap '[[ $? -ne 0 ]] && exit 0' DEBUG
51 $cmd # invalid command
55 $ZTST_testdir/../Src/zsh -f ./zsh-trapreturn-bug2 2>erroutput.dif
59 print ${"$(< erroutput.dif)"%%:[^:]#: ./fdasfsdafd}
62 0: trapreturn handling bug is properly fixed
63 >./zsh-trapreturn-bug2:5
66 setopt localtraps localoptions debugbeforecmd
67 trap '(( LINENO == 4 )) && setopt errexit' DEBUG
71 [[ -o errexit ]] && print "Hey, ERREXIT is set!"
74 1:Skip line from DEBUG trap
78 # Assignments are a special case, since they use a simpler
79 # wordcode type, so we need to test skipping them separately.
81 setopt localtraps localoptions debugbeforecmd
82 trap '(( LINENO == 4 )) && setopt errexit' DEBUG
86 [[ -o errexit ]] && print "Hey, ERREXIT is set!"
89 1:Skip assignment from DEBUG trap
93 setopt localtraps localoptions debugbeforecmd
94 trap 'print $LINENO' DEBUG
95 [[ a = a ]] && print a is ok
98 0:line numbers of complex sublists
103 setopt localtraps localoptions debugbeforecmd
104 trap 'print $LINENO' DEBUG
112 0:line numbers of multiline assignments
122 emulate -L zsh; setopt debugbeforecmd
123 trap 'print "$LINENO: '\''$ZSH_DEBUG_CMD'\''"' DEBUG
133 0:ZSH_DEBUG_CMD in debug traps
134 >3: 'print foo && print bar || print rod'
148 emulate -L zsh; setopt debugbeforecmd
149 trap '[[ $ZSH_DEBUG_CMD == *bar* ]] && return 2' DEBUG
154 2:Status of forced return from eval-style DEBUG trap
159 rm -f bug-file bug-file2 erroutput.dif zsh-trapreturn-bug2