about summary refs log tree commit diff
path: root/Test
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2008-08-31 19:50:47 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2008-08-31 19:50:47 +0000
commit2e3363ef7d1492bf8644b7cad89e500c3fc3251b (patch)
tree76c78bab1cefdc22c428105af8a1f30475583505 /Test
parent2c52a13aa5d18797b6acdc40b03dfd1bc3a60eeb (diff)
downloadzsh-2e3363ef7d1492bf8644b7cad89e500c3fc3251b.tar.gz
zsh-2e3363ef7d1492bf8644b7cad89e500c3fc3251b.tar.xz
zsh-2e3363ef7d1492bf8644b7cad89e500c3fc3251b.zip
25571: when parsing use line numbers for the start of a token, not the end
add test and move debug trap tests to new file
Diffstat (limited to 'Test')
-rw-r--r--Test/.distfiles1
-rw-r--r--Test/C03traps.ztst88
-rw-r--r--Test/C05debug.ztst114
3 files changed, 115 insertions, 88 deletions
diff --git a/Test/.distfiles b/Test/.distfiles
index 740e36d96..6b72d8965 100644
--- a/Test/.distfiles
+++ b/Test/.distfiles
@@ -17,6 +17,7 @@ C01arith.ztst
 C02cond.ztst
 C03traps.ztst
 C04funcdef.ztst
+C05debug.ztst
 D01prompt.ztst
 D02glob.ztst
 D03procsubst.ztst
diff --git a/Test/C03traps.ztst b/Test/C03traps.ztst
index f0bfd296a..7c4501413 100644
--- a/Test/C03traps.ztst
+++ b/Test/C03traps.ztst
@@ -350,94 +350,6 @@
 >trap
 >Working 0
 
-  unsetopt DEBUG_BEFORE_CMD
-  debug-trap-bug1() {
-    setopt localtraps
-    print "print bug file here" >bug-file
-    print "print this is line one
-    print this is line two
-    print this is line three
-    print and this is line fifty-nine." >bug-file2
-    function debug_trap_handler {
-	print $functrace[1]
-	do_bug
-    }
-    function do_bug {
-       . ./bug-file
-    }
-    trap 'echo EXIT hit' EXIT
-    trap 'debug_trap_handler' DEBUG
-    . ./bug-file2
-  }
-  debug-trap-bug1
-0: Relationship between traps and sources
->debug-trap-bug1:15
->bug file here
->this is line one
->./bug-file2:1
->bug file here
->this is line two
->./bug-file2:2
->bug file here
->this is line three
->./bug-file2:3
->bug file here
->and this is line fifty-nine.
->./bug-file2:4
->bug file here
->debug-trap-bug1:16
->bug file here
->EXIT hit
-
-  cat >zsh-trapreturn-bug2 <<-'HERE'
-	cmd='./fdasfsdafd'
-	[[ -x $cmd ]] && rm $cmd
-	set -o DEBUG_BEFORE_CMD
-	trap '[[ $? -ne 0 ]] && exit 0' DEBUG
-	$cmd  # invalid command
-	# Failure
-	exit 10
-	HERE
-  $ZTST_testdir/../Src/zsh -f ./zsh-trapreturn-bug2
-0: trapreturn handling bug is properly fixed
-?./zsh-trapreturn-bug2:5: no such file or directory: ./fdasfsdafd
-
-  fn() {
-    setopt localtraps localoptions debugbeforecmd
-    trap '(( LINENO == 4 )) && setopt errexit' DEBUG
-    print $LINENO three
-    print $LINENO four
-    print $LINENO five
-    [[ -o errexit ]] && print "Hey, ERREXIT is set!"
-  }
-  fn
-1:Skip line from DEBUG trap
->3 three
->5 five
-
-  # Assignments are a special case, since they use a simpler
-  # wordcode type, so we need to test skipping them separately.
-  fn() {
-    setopt localtraps localoptions debugbeforecmd
-    trap '(( LINENO == 4 )) && setopt errexit' DEBUG
-    x=three
-    x=four
-    print $LINENO $x
-    [[ -o errexit ]] && print "Hey, ERREXIT is set!"
-  }
-  fn
-1:Skip assignment from DEBUG trap
->5 three
-
-  fn() {
-    setopt localtraps localoptions debugbeforecmd
-    trap 'print $LINENO' DEBUG
-    [[ a = a ]] && print a is ok
-  }
-  fn
-0:line numbers of complex sublists
->3
->a is ok
 
 %clean
 
diff --git a/Test/C05debug.ztst b/Test/C05debug.ztst
new file mode 100644
index 000000000..a6ef54bb4
--- /dev/null
+++ b/Test/C05debug.ztst
@@ -0,0 +1,114 @@
+%prep
+
+  setopt localtraps
+
+%test
+
+  unsetopt DEBUG_BEFORE_CMD
+  debug-trap-bug1() {
+    setopt localtraps
+    print "print bug file here" >bug-file
+    print "print this is line one
+    print this is line two
+    print this is line three
+    print and this is line fifty-nine." >bug-file2
+    function debug_trap_handler {
+	print $functrace[1]
+	do_bug
+    }
+    function do_bug {
+       . ./bug-file
+    }
+    trap 'echo EXIT hit' EXIT
+    trap 'debug_trap_handler' DEBUG
+    . ./bug-file2
+  }
+  debug-trap-bug1
+0: Relationship between traps and sources
+>debug-trap-bug1:15
+>bug file here
+>this is line one
+>./bug-file2:1
+>bug file here
+>this is line two
+>./bug-file2:2
+>bug file here
+>this is line three
+>./bug-file2:3
+>bug file here
+>and this is line fifty-nine.
+>./bug-file2:4
+>bug file here
+>debug-trap-bug1:16
+>bug file here
+>EXIT hit
+
+  cat >zsh-trapreturn-bug2 <<-'HERE'
+	cmd='./fdasfsdafd'
+	[[ -x $cmd ]] && rm $cmd
+	set -o DEBUG_BEFORE_CMD
+	trap '[[ $? -ne 0 ]] && exit 0' DEBUG
+	$cmd  # invalid command
+	# Failure
+	exit 10
+	HERE
+  $ZTST_testdir/../Src/zsh -f ./zsh-trapreturn-bug2
+0: trapreturn handling bug is properly fixed
+?./zsh-trapreturn-bug2:5: no such file or directory: ./fdasfsdafd
+
+  fn() {
+    setopt localtraps localoptions debugbeforecmd
+    trap '(( LINENO == 4 )) && setopt errexit' DEBUG
+    print $LINENO three
+    print $LINENO four
+    print $LINENO five
+    [[ -o errexit ]] && print "Hey, ERREXIT is set!"
+  }
+  fn
+1:Skip line from DEBUG trap
+>3 three
+>5 five
+
+  # Assignments are a special case, since they use a simpler
+  # wordcode type, so we need to test skipping them separately.
+  fn() {
+    setopt localtraps localoptions debugbeforecmd
+    trap '(( LINENO == 4 )) && setopt errexit' DEBUG
+    x=three
+    x=four
+    print $LINENO $x
+    [[ -o errexit ]] && print "Hey, ERREXIT is set!"
+  }
+  fn
+1:Skip assignment from DEBUG trap
+>5 three
+
+  fn() {
+    setopt localtraps localoptions debugbeforecmd
+    trap 'print $LINENO' DEBUG
+    [[ a = a ]] && print a is ok
+  }
+  fn
+0:line numbers of complex sublists
+>3
+>a is ok
+
+  fn() {
+    setopt localtraps localoptions debugbeforecmd
+    trap 'print $LINENO' DEBUG
+    print before
+    x='    first
+    second
+    third'
+    print $x
+  }
+  fn
+0:line numbers of multiline assignments
+>3
+>before
+>4
+>7
+>    first
+>    second
+>    third
+