summaryrefslogtreecommitdiffstats
path: root/tests/util.test
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2003-08-27 20:09:49 (GMT)
committerdgp <dgp@users.sourceforge.net>2003-08-27 20:09:49 (GMT)
commit758447b224c0281798e3ea384b40d6deaa74902b (patch)
tree0dda0b6ece91b722a579df0137cac2e479c987b3 /tests/util.test
parentd5b3a83348608a67789570a2a477e0f204681bfd (diff)
downloadtcl-758447b224c0281798e3ea384b40d6deaa74902b.zip
tcl-758447b224c0281798e3ea384b40d6deaa74902b.tar.gz
tcl-758447b224c0281798e3ea384b40d6deaa74902b.tar.bz2
* generic/tclUtil.c: Corrected [Bug 411825] and other bugs in
TclNeedSpace() where non-breaking space (\u00A0) and backslash-escaped spaces were handled incorrectly. * tests/util.test: Added new tests util-8.[2-6].
Diffstat (limited to 'tests/util.test')
-rw-r--r--tests/util.test22
1 files changed, 21 insertions, 1 deletions
diff --git a/tests/util.test b/tests/util.test
index 9341047..a3d181c 100644
--- a/tests/util.test
+++ b/tests/util.test
@@ -7,7 +7,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: util.test,v 1.10.4.1 2003/08/27 17:56:46 dgp Exp $
+# RCS: @(#) $Id: util.test,v 1.10.4.2 2003/08/27 20:09:49 dgp Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
@@ -342,6 +342,26 @@ test util-8.4 {TclNeedSpace - correct UTF8 handling} testdstring {
testdstring element foo
llength [testdstring get]
} 2
+test util-8.5 {TclNeedSpace - correct UTF8 handling} testdstring {
+ # Note that in this test TclNeedSpace actually gets it wrong,
+ # claiming we need a space when we really do not. Extra space
+ # between list elements is harmless though, and better to have
+ # extra space in really weird string reps of lists, than to
+ # invest the effort required to make TclNeedSpace foolproof.
+ testdstring free
+ testdstring append {\\ } -1
+ testdstring element foo
+ list [llength [testdstring get]] [string length [testdstring get]]
+} {2 7}
+test util-8.6 {TclNeedSpace - correct UTF8 handling} testdstring {
+ # Another example of TclNeedSpace harmlessly getting it wrong.
+ testdstring free
+ testdstring append {\\ } -1
+ testdstring append \{ -1
+ testdstring element foo
+ testdstring append \} -1
+ list [llength [testdstring get]] [string length [testdstring get]]
+} {2 9}
# cleanup
::tcltest::cleanupTests