diff options
author | sebres <sebres@users.sourceforge.net> | 2019-08-27 18:27:05 (GMT) |
---|---|---|
committer | sebres <sebres@users.sourceforge.net> | 2019-08-27 18:27:05 (GMT) |
commit | aab801db76cd9d4f54a978ebbd1eed7a0ee05c4a (patch) | |
tree | 6759e19638b6df97246ea1af26ed1663c4c54c43 /tests | |
parent | 4dce06b63d5e6540b8b18a6f5c747352aa872b8a (diff) | |
parent | cf0b9b27229540852823f29cc7cbeeaa2be4c20c (diff) | |
download | tcl-aab801db76cd9d4f54a978ebbd1eed7a0ee05c4a.zip tcl-aab801db76cd9d4f54a978ebbd1eed7a0ee05c4a.tar.gz tcl-aab801db76cd9d4f54a978ebbd1eed7a0ee05c4a.tar.bz2 |
closes [fa6bf38d07]: integrate bug-fa6bf38d07-v2
Diffstat (limited to 'tests')
-rw-r--r-- | tests/execute.test | 81 |
1 files changed, 77 insertions, 4 deletions
diff --git a/tests/execute.test b/tests/execute.test index e9668a9..72d79fd 100644 --- a/tests/execute.test +++ b/tests/execute.test @@ -37,6 +37,11 @@ testConstraint testobj [expr { testConstraint longIs32bit [expr {int(0x80000000) < 0}] 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 @@ -933,8 +938,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 } @@ -948,8 +952,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 { @@ -978,6 +981,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 { |