summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2020-04-09 15:56:26 (GMT)
committerdgp <dgp@users.sourceforge.net>2020-04-09 15:56:26 (GMT)
commit94a4f5be20584689a3ab5fe061fbc304c7cd18b3 (patch)
tree4fec1a5032a5d021908d47c83b393f98705950d8
parent50eee151a907e29a58d8201f66988816ae14eae5 (diff)
downloadtcl-94a4f5be20584689a3ab5fe061fbc304c7cd18b3.zip
tcl-94a4f5be20584689a3ab5fe061fbc304c7cd18b3.tar.gz
tcl-94a4f5be20584689a3ab5fe061fbc304c7cd18b3.tar.bz2
New tests demonstrating bug in TclNeedSpace(): improper handling escaped space.
-rw-r--r--tests/util.test45
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/util.test b/tests/util.test
index 61a1790..294d883 100644
--- a/tests/util.test
+++ b/tests/util.test
@@ -522,6 +522,51 @@ test util-8.6 {TclNeedSpace - correct UTF8 handling} testdstring {
testdstring append \} -1
list [llength [testdstring get]] [string length [testdstring get]]
} {2 9}
+test util-8.7 {TclNeedSpace - watch out for escaped space} {
+ testdstring free
+ testdstring append {\ } -1
+ testdstring start
+ testdstring end
+
+ # Should make {\ {}}
+ list [llength [testdstring get]] [string index [testdstring get] 3]
+} {2 \{}
+test util-8.8 {TclNeedSpace - watch out for escaped space} {
+ testdstring free
+ testdstring append {\\ } -1
+ testdstring start
+ testdstring end
+
+ # Should make {\\ {}}
+ list [llength [testdstring get]] [string index [testdstring get] 3]
+} {2 \{}
+test util-8.9 {TclNeedSpace - watch out for escaped space} {
+ testdstring free
+ testdstring append {\\\ } -1
+ testdstring start
+ testdstring end
+
+ # Should make {\\\ {}}
+ list [llength [testdstring get]] [string index [testdstring get] 5]
+} {2 \{}
+test util-8.10 {TclNeedSpace - watch out for escaped space} {
+ testdstring free
+ testdstring append {\\\\\\\ } -1
+ testdstring start
+ testdstring end
+
+ # Should make {\\\\\\\ {}}
+ list [llength [testdstring get]] [string index [testdstring get] 9]
+} {2 \{}
+test util-8.11 {TclNeedSpace - watch out for escaped space} {
+ testdstring free
+ testdstring append {\\\\\\\\ } -1
+ testdstring start
+ testdstring end
+
+ # Should make {\\\\\\\\ {}}
+ list [llength [testdstring get]] [string index [testdstring get] 9]
+} {2 \{}
test util-9.0.0 {TclGetIntForIndex} {
string index abcd 0