summaryrefslogtreecommitdiffstats
path: root/tests/execute.test
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2019-08-28 13:17:21 (GMT)
committerdgp <dgp@users.sourceforge.net>2019-08-28 13:17:21 (GMT)
commita289e0b6140ac130a7352f08ce45846fb89d9da2 (patch)
tree670e6b49d8e6c2cdcc8148171af4ab0d144fd9a0 /tests/execute.test
parent137b4196664a2909eb1b370a19cc11b661ee3429 (diff)
parentb7f809ade5521067cf0d90daa4b24ae48fd7e525 (diff)
downloadtcl-a289e0b6140ac130a7352f08ce45846fb89d9da2.zip
tcl-a289e0b6140ac130a7352f08ce45846fb89d9da2.tar.gz
tcl-a289e0b6140ac130a7352f08ce45846fb89d9da2.tar.bz2
merge trunk
Diffstat (limited to 'tests/execute.test')
-rw-r--r--tests/execute.test81
1 files changed, 77 insertions, 4 deletions
diff --git a/tests/execute.test b/tests/execute.test
index 55fb01b..170661d 100644
--- a/tests/execute.test
+++ b/tests/execute.test
@@ -37,6 +37,11 @@ testConstraint testobj [expr {
testConstraint longIs32bit [expr {$tcl_platform(wordSize) == 4}]
testConstraint testexprlongobj [llength [info commands testexprlongobj]]
+
+if {[namespace which -command testbumpinterpepoch] eq ""} {
+ proc testbumpinterpepoch {} { rename ::set ::dummy; rename ::dummy ::set }
+}
+
# Tests for the omnibus TclExecuteByteCode function:
# INST_DONE not tested
@@ -929,8 +934,7 @@ test execute-8.3 {Stack restoration} -setup {
proc f {args} "f $arglst"
proc run {} {
# bump the interp's epoch
- rename ::set ::dummy
- rename ::dummy ::set
+ testbumpinterpepoch
catch f msg
set msg
}
@@ -944,8 +948,7 @@ test execute-8.4 {Compile epoch bump effect on stack trace} -setup {
}
proc FOO {} {
catch {error bar} m o
- rename ::set ::dummy
- rename ::dummy ::set
+ testbumpinterpepoch
return -options $o $m
}
} -body {
@@ -974,6 +977,76 @@ test execute-8.5 {Bug 2038069} -setup {
invoked from within
"catch \[list error FOO\] m o"} -errorline 2}
+test execute-8.6 {Compile epoch bump in global level (bug [fa6bf38d07])} -setup {
+ interp create slave
+ slave eval {
+ package require tcltest
+ catch [list package require -exact Tcltest [info patchlevel]]
+ ::tcltest::loadTestedCommands
+ if {[namespace which -command testbumpinterpepoch] eq ""} {
+ proc testbumpinterpepoch {} { rename ::set ::dummy; rename ::dummy ::set }
+ }
+ }
+} -body {
+ slave eval {
+ lappend res A; testbumpinterpepoch; lappend res B; return; lappend res C;
+ }
+ slave eval {
+ set i 0; while {[incr i] < 3} {
+ lappend res A; testbumpinterpepoch; lappend res B; return; lappend res C;
+ }
+ }
+ slave eval {
+ set i 0; while {[incr i] < 3} {
+ lappend res A; testbumpinterpepoch; lappend res B; break; lappend res C;
+ }
+ }
+ slave eval {
+ catch {
+ lappend res A; testbumpinterpepoch; lappend res B; error test; lappend res C;
+ }
+ }
+ slave eval {set res}
+} -cleanup {
+ interp delete slave
+} -result [lrepeat 4 A B]
+test execute-8.7 {Compile epoch bump in global level (bug [fa6bf38d07]), exception case} -setup {
+ interp create slave
+ slave eval {
+ package require tcltest
+ catch [list package require -exact Tcltest [info patchlevel]]
+ ::tcltest::loadTestedCommands
+ if {[namespace which -command testbumpinterpepoch] eq ""} {
+ proc testbumpinterpepoch {} { rename ::set ::dummy; rename ::dummy ::set }
+ }
+ }
+} -body {
+ set res {}
+ lappend res [catch {
+ slave eval {
+ lappend res A; testbumpinterpepoch; lappend res B; return -code error test; lappend res C;
+ }
+ } e] $e
+ lappend res [catch {
+ slave eval {
+ lappend res A; testbumpinterpepoch; lappend res B; error test; lappend res C;
+ }
+ } e] $e
+ lappend res [catch {
+ slave eval {
+ lappend res A; testbumpinterpepoch; lappend res B; return -code return test; lappend res C;
+ }
+ } e] $e
+ lappend res [catch {
+ slave eval {
+ lappend res A; testbumpinterpepoch; lappend res B; break; lappend res C;
+ }
+ } e] $e
+ list $res [slave eval {set res}]
+} -cleanup {
+ interp delete slave
+} -result [list {1 test 1 test 2 test 3 {}} [lrepeat 4 A B]]
+
test execute-9.1 {Interp result resetting [Bug 1522803]} {
set c 0
catch {