summaryrefslogtreecommitdiffstats
path: root/tests/stringObj.test
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2009-02-16 04:06:07 (GMT)
committerdgp <dgp@users.sourceforge.net>2009-02-16 04:06:07 (GMT)
commit83b89e4cb82d0744ad11a21b568e43fc6398f605 (patch)
treeea2e98682595184a07576b9fa957f3ccb18537ab /tests/stringObj.test
parent53a6c6e15b5a20bc8c7bb870aba701855f8da484 (diff)
downloadtcl-83b89e4cb82d0744ad11a21b568e43fc6398f605.zip
tcl-83b89e4cb82d0744ad11a21b568e43fc6398f605.tar.gz
tcl-83b89e4cb82d0744ad11a21b568e43fc6398f605.tar.bz2
* generic/tclStringObj.c: Added protections from invalid memory
* generic/tclTestObj.c: accesses when we append (some part of) * tests/stringObj.test: a Tcl_Obj to itself. Added the appendself and appendself2 subcommands to the [teststringobj] testing command and added tests to the test suite. [Bug 2603158]
Diffstat (limited to 'tests/stringObj.test')
-rw-r--r--tests/stringObj.test36
1 files changed, 35 insertions, 1 deletions
diff --git a/tests/stringObj.test b/tests/stringObj.test
index 8b38542..7489df2 100644
--- a/tests/stringObj.test
+++ b/tests/stringObj.test
@@ -12,7 +12,7 @@
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: stringObj.test,v 1.18 2009/01/29 22:14:56 dkf Exp $
+# RCS: @(#) $Id: stringObj.test,v 1.19 2009/02/16 04:06:08 dgp Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
@@ -439,6 +439,40 @@ test stringObj-14.1 {Tcl_SetObjLength on pure unicode object} testobj {
teststringobj append 1 bar -1
teststringobj get 1
} {bar}
+
+test stringObj-15.1 {Tcl_Append*ToObj: self appends} {
+ teststringobj set 1 foo
+ teststringobj appendself 1 0
+} foofoo
+test stringObj-15.2 {Tcl_Append*ToObj: self appends} {
+ teststringobj set 1 foo
+ teststringobj appendself 1 1
+} foooo
+test stringObj-15.3 {Tcl_Append*ToObj: self appends} {
+ teststringobj set 1 foo
+ teststringobj appendself 1 2
+} fooo
+test stringObj-15.4 {Tcl_Append*ToObj: self appends} {
+ teststringobj set 1 foo
+ teststringobj appendself 1 3
+} foo
+test stringObj-15.5 {Tcl_Append*ToObj: self appends} {
+ teststringobj set 1 foo
+ teststringobj appendself2 1 0
+} foofoo
+test stringObj-15.6 {Tcl_Append*ToObj: self appends} {
+ teststringobj set 1 foo
+ teststringobj appendself2 1 1
+} foooo
+test stringObj-15.7 {Tcl_Append*ToObj: self appends} {
+ teststringobj set 1 foo
+ teststringobj appendself2 1 2
+} fooo
+test stringObj-15.8 {Tcl_Append*ToObj: self appends} {
+ teststringobj set 1 foo
+ teststringobj appendself2 1 3
+} foo
+
if {[testConstraint testobj]} {
testobj freeallvars