summaryrefslogtreecommitdiffstats
path: root/tests/string.test
diff options
context:
space:
mode:
Diffstat (limited to 'tests/string.test')
-rw-r--r--tests/string.test63
1 files changed, 35 insertions, 28 deletions
diff --git a/tests/string.test b/tests/string.test
index 5891f1f..f95bc25 100644
--- a/tests/string.test
+++ b/tests/string.test
@@ -280,7 +280,7 @@ test string-3.17.$noComp {string equal, unicode} {
} 1
test string-3.18.$noComp {string equal, unicode} {
run {string equal \334 \u00fc}
-} 0
+} 0
test string-3.19.$noComp {string equal, unicode} {
run {string equal \334\334\334\374\374 \334\334\334\334\334}
} 0
@@ -307,7 +307,7 @@ test string-3.24.$noComp {string equal -nocase with length} {
} 1
test string-3.25.$noComp {string equal -nocase with length} {
run {string equal -nocase -length 3 abcde Abxyz}
-} 0
+} 0
test string-3.26.$noComp {string equal -nocase with length <= 0} {
run {string equal -nocase -length -1 abcde AbCdEf}
} 0
@@ -2307,86 +2307,93 @@ test string-29.15.$noComp {string cat, efficiency} -setup {
} -match glob -result {*no string representation}
}
-# Note: string-30.* tests use [tcl::string::insert] rather than [string insert]
+test string-30.1.1.$noComp {[Bug ba921a8d98]: string cat} {
+ run {string cat [set data [binary format a* hello]] [encoding convertto $data] [unset data]}
+} hellohello
+test string-30.1.2.$noComp {[Bug ba921a8d98]: inplace cat by subst (compiled to "strcat" instruction)} {
+ run {set x "[set data [binary format a* hello]][encoding convertto $data][unset data]"}
+} hellohello
+
+# Note: string-31.* tests use [tcl::string::insert] rather than [string insert]
# to dodge ticket [3397978fff] which would cause all arguments to be shared,
# thereby preventing the optimizations from being tested.
-test string-30.1.$noComp {string insert, start of string} {
+test string-31.1.$noComp {string insert, start of string} {
run {tcl::string::insert 0123 0 _}
} _0123
-test string-30.2.$noComp {string insert, middle of string} {
+test string-31.2.$noComp {string insert, middle of string} {
run {tcl::string::insert 0123 2 _}
} 01_23
-test string-30.3.$noComp {string insert, end of string} {
+test string-31.3.$noComp {string insert, end of string} {
run {tcl::string::insert 0123 4 _}
} 0123_
-test string-30.4.$noComp {string insert, start of string, end-relative} {
+test string-31.4.$noComp {string insert, start of string, end-relative} {
run {tcl::string::insert 0123 end-4 _}
} _0123
-test string-30.5.$noComp {string insert, middle of string, end-relative} {
+test string-31.5.$noComp {string insert, middle of string, end-relative} {
run {tcl::string::insert 0123 end-2 _}
} 01_23
-test string-30.6.$noComp {string insert, end of string, end-relative} {
+test string-31.6.$noComp {string insert, end of string, end-relative} {
run {tcl::string::insert 0123 end _}
} 0123_
-test string-30.7.$noComp {string insert, empty target string} {
+test string-31.7.$noComp {string insert, empty target string} {
run {tcl::string::insert {} 0 _}
} _
-test string-30.8.$noComp {string insert, empty insert string} {
+test string-31.8.$noComp {string insert, empty insert string} {
run {tcl::string::insert 0123 0 {}}
} 0123
-test string-30.9.$noComp {string insert, empty strings} {
+test string-31.9.$noComp {string insert, empty strings} {
run {tcl::string::insert {} 0 {}}
} {}
-test string-30.10.$noComp {string insert, negative index} {
+test string-31.10.$noComp {string insert, negative index} {
run {tcl::string::insert 0123 -1 _}
} _0123
-test string-30.11.$noComp {string insert, index beyond end} {
+test string-31.11.$noComp {string insert, index beyond end} {
run {tcl::string::insert 0123 5 _}
} 0123_
-test string-30.12.$noComp {string insert, start of string, pure byte array} {
+test string-31.12.$noComp {string insert, start of string, pure byte array} {
run {tcl::string::insert [makeByteArray 0123] 0 [makeByteArray _]}
} _0123
-test string-30.13.$noComp {string insert, middle of string, pure byte array} {
+test string-31.13.$noComp {string insert, middle of string, pure byte array} {
run {tcl::string::insert [makeByteArray 0123] 2 [makeByteArray _]}
} 01_23
-test string-30.14.$noComp {string insert, end of string, pure byte array} {
+test string-31.14.$noComp {string insert, end of string, pure byte array} {
run {tcl::string::insert [makeByteArray 0123] 4 [makeByteArray _]}
} 0123_
-test string-30.15.$noComp {string insert, pure byte array, neither shared} {
+test string-31.15.$noComp {string insert, pure byte array, neither shared} {
run {tcl::string::insert [makeByteArray 0123] 2 [makeByteArray _]}
} 01_23
-test string-30.16.$noComp {string insert, pure byte array, first shared} {
+test string-31.16.$noComp {string insert, pure byte array, first shared} {
run {tcl::string::insert [makeShared [makeByteArray 0123]] 2\
[makeByteArray _]}
} 01_23
-test string-30.17.$noComp {string insert, pure byte array, second shared} {
+test string-31.17.$noComp {string insert, pure byte array, second shared} {
run {tcl::string::insert [makeByteArray 0123] 2\
[makeShared [makeByteArray _]]}
} 01_23
-test string-30.18.$noComp {string insert, pure byte array, both shared} {
+test string-31.18.$noComp {string insert, pure byte array, both shared} {
run {tcl::string::insert [makeShared [makeByteArray 0123]] 2\
[makeShared [makeByteArray _]]}
} 01_23
-test string-30.19.$noComp {string insert, start of string, pure Unicode} {
+test string-31.19.$noComp {string insert, start of string, pure Unicode} {
run {tcl::string::insert [makeUnicode 0123] 0 [makeUnicode _]}
} _0123
-test string-30.20.$noComp {string insert, middle of string, pure Unicode} {
+test string-31.20.$noComp {string insert, middle of string, pure Unicode} {
run {tcl::string::insert [makeUnicode 0123] 2 [makeUnicode _]}
} 01_23
-test string-30.21.$noComp {string insert, end of string, pure Unicode} {
+test string-31.21.$noComp {string insert, end of string, pure Unicode} {
run {tcl::string::insert [makeUnicode 0123] 4 [makeUnicode _]}
} 0123_
-test string-30.22.$noComp {string insert, str start, pure Uni, first shared} {
+test string-31.22.$noComp {string insert, str start, pure Uni, first shared} {
run {tcl::string::insert [makeShared [makeUnicode 0123]] 0 [makeUnicode _]}
} _0123
-test string-30.23.$noComp {string insert, string mid, pure Uni, 2nd shared} {
+test string-31.23.$noComp {string insert, string mid, pure Uni, 2nd shared} {
run {tcl::string::insert [makeUnicode 0123] 2 [makeShared [makeUnicode _]]}
} 01_23
-test string-30.24.$noComp {string insert, string end, pure Uni, both shared} {
+test string-31.24.$noComp {string insert, string end, pure Uni, both shared} {
run {tcl::string::insert [makeShared [makeUnicode 0123]] 4\
[makeShared [makeUnicode _]]}
} 0123_
-test string-30.25.$noComp {string insert, neither byte array nor Unicode} {
+test string-31.25.$noComp {string insert, neither byte array nor Unicode} {
run {tcl::string::insert [makeList a b c] 1 zzzzzz}
} {azzzzzz b c}