summaryrefslogtreecommitdiffstats
path: root/tests/stringComp.test
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2014-05-01 15:16:37 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2014-05-01 15:16:37 (GMT)
commitecc261fff02041b94a2ff589a0f7b7191a6cf975 (patch)
treecaab1eb18613bb672c08214eab97c65743f7587e /tests/stringComp.test
parent1f6f16eb0acd800c01eb3eb44390f314983b353f (diff)
parent09c394df7d97291aecb28a07a6c5de3f0814a341 (diff)
downloadtcl-ecc261fff02041b94a2ff589a0f7b7191a6cf975.zip
tcl-ecc261fff02041b94a2ff589a0f7b7191a6cf975.tar.gz
tcl-ecc261fff02041b94a2ff589a0f7b7191a6cf975.tar.bz2
merge trunk
Diffstat (limited to 'tests/stringComp.test')
-rw-r--r--tests/stringComp.test34
1 files changed, 33 insertions, 1 deletions
diff --git a/tests/stringComp.test b/tests/stringComp.test
index 210f431..1ebda90 100644
--- a/tests/stringComp.test
+++ b/tests/stringComp.test
@@ -26,6 +26,22 @@ catch [list package require -exact Tcltest [info patchlevel]]
# Some tests require the testobj command
testConstraint testobj [expr {[info commands testobj] != {}}]
+testConstraint memory [llength [info commands memory]]
+if {[testConstraint memory]} {
+ proc getbytes {} {
+ set lines [split [memory info] \n]
+ return [lindex $lines 3 3]
+ }
+ proc leaktest {script {iterations 3}} {
+ set end [getbytes]
+ for {set i 0} {$i < $iterations} {incr i} {
+ uplevel 1 $script
+ set tmp $end
+ set end [getbytes]
+ }
+ return [expr {$end - $tmp}]
+ }
+}
test stringComp-1.1 {error conditions} {
proc foo {} {string gorp a b}
@@ -687,7 +703,23 @@ test stringComp-12.1 {Bug 3588366: end-offsets before start} {
## not yet bc
## string replace
-## not yet bc
+test stringComp-14.1 {Bug 82e7f67325} {
+ apply {x {
+ set a [join $x {}]
+ lappend b [string length [string replace ___! 0 2 $a]]
+ lappend b [string length [string replace ___! 0 2 $a[unset a]]]
+ }} {a b}
+} {3 3}
+test stringComp-14.2 {Bug 82e7f67325} memory {
+ # As in stringComp-14.1, but make sure we don't retain too many refs
+ leaktest {
+ apply {x {
+ set a [join $x {}]
+ lappend b [string length [string replace ___! 0 2 $a]]
+ lappend b [string length [string replace ___! 0 2 $a[unset a]]]
+ }} {a b}
+ }
+} {0}
## string tolower
## not yet bc