diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2016-03-02 09:06:08 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2016-03-02 09:06:08 (GMT) |
commit | a87d7d11f70a87878421ef703097605cb64222e4 (patch) | |
tree | bcceb6ef5832e9250aa7728e24957e2a16ddb41a /tests | |
parent | ecd0e0dcdd401906fc8e82d1a6cb02f69321c87a (diff) | |
parent | a312878e5b152c92c1736dc39f29007e19efab61 (diff) | |
download | tcl-a87d7d11f70a87878421ef703097605cb64222e4.zip tcl-a87d7d11f70a87878421ef703097605cb64222e4.tar.gz tcl-a87d7d11f70a87878421ef703097605cb64222e4.tar.bz2 |
Merge trunk
Diffstat (limited to 'tests')
-rw-r--r-- | tests/env.test | 36 | ||||
-rw-r--r-- | tests/msgcat.test | 1 | ||||
-rw-r--r-- | tests/var.test | 28 |
3 files changed, 52 insertions, 13 deletions
diff --git a/tests/env.test b/tests/env.test index 83d99e0..9f59fbc 100644 --- a/tests/env.test +++ b/tests/env.test @@ -278,20 +278,20 @@ test env-5.4 {corner cases - unset the env array} -setup { } -cleanup { interp delete i } -result {1 a 1} -test env-5.5 {corner cases - cannot have null entries on Windows} {win} { +test env-5.5 {corner cases - cannot have null entries on Windows} -constraints win -body { set env() a catch {set env()} -} {1} +} -result 1 -test env-6.1 {corner cases - add lots of env variables} {} { +test env-6.1 {corner cases - add lots of env variables} -body { set size [array size env] for {set i 0} {$i < 100} {incr i} { set env(BOGUS$i) $i } expr {[array size env] - $size} -} 100 +} -result 100 -test env-7.1 {[219226]: whole env array should not be unset by read} { +test env-7.1 {[219226]: whole env array should not be unset by read} -body { set n [array size env] set s [array startsearch env] while {[array anymore env $s]} { @@ -300,19 +300,29 @@ test env-7.1 {[219226]: whole env array should not be unset by read} { } array donesearch env $s return $n -} 0 -test env-7.2 {[219226]: links to env elements should not be removed by read} { +} -result 0 + +test env-7.2 {[219226]: links to env elements should not be removed by read} -body { apply {{} { set ::env(test7_2) ok upvar env(test7_2) elem set ::env(PATH) - try { - return $elem - } finally { - unset ::env(test7_2) - } + return $elem + }} +} -result ok + +test env-7.3 {[9b4702]: testing existence of env(some_thing) should not destroy trace} -body { + apply {{} { + catch {unset ::env(test7_3)} + proc foo args { + set ::env(test7_3) ok + } + trace add variable ::env(not_yet_existent) write foo + info exists ::env(not_yet_existent) + set ::env(not_yet_existent) "Now I'm here"; + return [info exists ::env(test7_3)] }} -} ok +} -result 1 # Restore the environment variables at the end of the test. diff --git a/tests/msgcat.test b/tests/msgcat.test index 62bcec9..741fc3b 100644 --- a/tests/msgcat.test +++ b/tests/msgcat.test @@ -995,6 +995,7 @@ namespace eval ::msgcat::test { mcloadedlocales clear } -cleanup { mcforgetpackage + after cancel set [namespace current]::resultvariable timeout } -body { mcpackageconfig set loadcmd [namespace code callbackfailproc] mclocale foo_bar diff --git a/tests/var.test b/tests/var.test index 0531746..b6b09fd 100644 --- a/tests/var.test +++ b/tests/var.test @@ -921,6 +921,34 @@ test var-22.0 {leak in array element unset: Bug a3309d01db} -setup { rename getbytes {} rename doit {} } -result 0 +test var-22.1 {leak in localVarName intrep: Bug 80304238ac} -setup { + proc getbytes {} { + lindex [split [memory info] \n] 3 3 + } + proc doit {} { + interp create slave + slave eval { + proc doit script { + eval $script + set foo bar + } + doit {foreach foo baz {}} + } + interp delete slave + } +} -constraints memory -body { + set end [getbytes] + for {set i 0} {$i < 5} {incr i} { + doit + set tmp $end + set end [getbytes] + } + set leakedBytes [expr {$end - $tmp}] +} -cleanup { + array unset A + rename getbytes {} + rename doit {} +} -result 0 catch {namespace delete ns} |