summaryrefslogtreecommitdiffstats
path: root/tests/stringObj.test
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2012-01-26 16:14:07 (GMT)
committerdgp <dgp@users.sourceforge.net>2012-01-26 16:14:07 (GMT)
commit4e5840745fe8bd929f716debb48a26d381fd8023 (patch)
treec4c54da9bb9f5638956e536acb3ad46b57194823 /tests/stringObj.test
parent7fa090fbeed5a9719ed0b2d2d09d3447e2b3406e (diff)
downloadtcl-4e5840745fe8bd929f716debb48a26d381fd8023.zip
tcl-4e5840745fe8bd929f716debb48a26d381fd8023.tar.gz
tcl-4e5840745fe8bd929f716debb48a26d381fd8023.tar.bz2
Backport more robust stringObj tests.
Diffstat (limited to 'tests/stringObj.test')
-rw-r--r--tests/stringObj.test65
1 files changed, 39 insertions, 26 deletions
diff --git a/tests/stringObj.test b/tests/stringObj.test
index 1ab3a48..3b25592 100644
--- a/tests/stringObj.test
+++ b/tests/stringObj.test
@@ -18,6 +18,7 @@ if {[lsearch [namespace children] ::tcltest] == -1} {
}
testConstraint testobj [llength [info commands testobj]]
+testConstraint testdstring [llength [info commands testdstring]]
test stringObj-1.1 {string type registration} testobj {
set t [testobj types]
@@ -229,13 +230,15 @@ test stringObj-8.5 {DupUnicodeInternalRep, all byte-size chars} testobj {
[set y] [testobj objtype $x] [testobj objtype $y]
} {string string abcdefghijkl abcdefghi string string}
-test stringObj-9.1 {TclAppendObjToObj, mixed src & dest} testobj {
- set x abcï¿®ghi
- set y ®¿ï
+test stringObj-9.1 {TclAppendObjToObj, mixed src & dest} {testobj testdstring} {
+ set x abc\u00ef\u00bf\u00aeghi
+ testdstring free
+ testdstring append \u00ae\u00bf\u00ef -1
+ set y [testdstring get]
string length $x
list [testobj objtype $x] [testobj objtype $y] [append x $y] \
- [set y] [testobj objtype $x] [testobj objtype $y]
-} {string none abcï¿®ghi®¿ï ®¿ï string none}
+ [set y] [testobj objtype $x] [testobj objtype $y]
+} "string none abc\u00ef\u00bf\u00aeghi\u00ae\u00bf\u00ef \u00ae\u00bf\u00ef string none"
test stringObj-9.2 {TclAppendObjToObj, mixed src & dest} testobj {
set x abcï¿®ghi
string length $x
@@ -244,19 +247,23 @@ test stringObj-9.2 {TclAppendObjToObj, mixed src & dest} testobj {
} {string abcï¿®ghiabcï¿®ghi string\
abcï¿®ghiabcï¿®ghiabcï¿®ghiabcï¿®ghi\
string}
-test stringObj-9.3 {TclAppendObjToObj, mixed src & 1-byte dest} testobj {
+test stringObj-9.3 {TclAppendObjToObj, mixed src & 1-byte dest} {testobj testdstring} {
set x abcdefghi
- set y ®¿ï
+ testdstring free
+ testdstring append \u00ae\u00bf\u00ef -1
+ set y [testdstring get]
string length $x
list [testobj objtype $x] [testobj objtype $y] [append x $y] \
- [set y] [testobj objtype $x] [testobj objtype $y]
-} {string none abcdefghi®¿ï ®¿ï string none}
-test stringObj-9.4 {TclAppendObjToObj, 1-byte src & dest} testobj {
+ [set y] [testobj objtype $x] [testobj objtype $y]
+} "string none abcdefghi\u00ae\u00bf\u00ef \u00ae\u00bf\u00ef string none"
+test stringObj-9.4 {TclAppendObjToObj, 1-byte src & dest} {testobj testdstring} {
set x abcdefghi
- set y jkl
+ testdstring free
+ testdstring append jkl -1
+ set y [testdstring get]
string length $x
list [testobj objtype $x] [testobj objtype $y] [append x $y] \
- [set y] [testobj objtype $x] [testobj objtype $y]
+ [set y] [testobj objtype $x] [testobj objtype $y]
} {string none abcdefghijkl jkl string none}
test stringObj-9.5 {TclAppendObjToObj, 1-byte src & dest} testobj {
set x abcdefghi
@@ -265,13 +272,15 @@ test stringObj-9.5 {TclAppendObjToObj, 1-byte src & dest} testobj {
[append x $x] [testobj objtype $x]
} {string abcdefghiabcdefghi string abcdefghiabcdefghiabcdefghiabcdefghi\
string}
-test stringObj-9.6 {TclAppendObjToObj, 1-byte src & mixed dest} testobj {
- set x abcï¿®ghi
- set y jkl
+test stringObj-9.6 {TclAppendObjToObj, 1-byte src & mixed dest} {testobj testdstring} {
+ set x abc\u00ef\u00bf\u00aeghi
+ testdstring free
+ testdstring append jkl -1
+ set y [testdstring get]
string length $x
list [testobj objtype $x] [testobj objtype $y] [append x $y] \
- [set y] [testobj objtype $x] [testobj objtype $y]
-} {string none abcï¿®ghijkl jkl string none}
+ [set y] [testobj objtype $x] [testobj objtype $y]
+} "string none abc\u00ef\u00bf\u00aeghijkl jkl string none"
test stringObj-9.7 {TclAppendObjToObj, integer src & dest} testobj {
set x [expr {4 * 5}]
set y [expr {4 + 5}]
@@ -316,20 +325,24 @@ test stringObj-9.11 {TclAppendObjToObj, mixed src & 1-byte dest index check} tes
set q
} {a b c d e f a ü b å c ï}
-test stringObj-10.1 {Tcl_GetRange with all byte-size chars} testobj {
- set x "abcdef"
+test stringObj-10.1 {Tcl_GetRange with all byte-size chars} {testobj testdstring} {
+ testdstring free
+ testdstring append abcdef -1
+ set x [testdstring get]
list [testobj objtype $x] [set y [string range $x 1 end-1]] \
- [testobj objtype $x] [testobj objtype $y]
+ [testobj objtype $x] [testobj objtype $y]
} [list none bcde string string]
-test stringObj-10.2 {Tcl_GetRange with some mixed width chars} testobj {
+test stringObj-10.2 {Tcl_GetRange with some mixed width chars} {testobj testdstring} {
# Because this test does not use \uXXXX notation below instead of
- # hardcoding the values, it may fail in multibyte locales. However,
- # we need to test that the parser produces untyped objects even when there
- # are high-ASCII characters in the input (like "ï"). I don't know what
+ # hardcoding the values, it may fail in multibyte locales. However, we
+ # need to test that the parser produces untyped objects even when there
+ # are high-ASCII characters in the input (like "ï"). I don't know what
# else to do but inline those characters here.
- set x "abcïïdef"
+ testdstring free
+ testdstring append "abc\u00ef\u00efdef" -1
+ set x [testdstring get]
list [testobj objtype $x] [set y [string range $x 1 end-1]] \
- [testobj objtype $x] [testobj objtype $y]
+ [testobj objtype $x] [testobj objtype $y]
} [list none "bc\u00EF\u00EFde" string string]
test stringObj-10.3 {Tcl_GetRange with some mixed width chars} testobj {
# set x "abcïïdef"