summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--tests/util.test37
2 files changed, 41 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index cf21146..62186a2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2003-08-27 Don Porter <dgp@users.sourceforge.net>
+
+ * tests/util.test: Added new tests for remaining TclNeedSpace()
+ bugs discussed in [Bug 411825].
+
2003-08-06 Jeff Hobbs <jeffh@ActiveState.com>
* win/tclWinInit.c: recognize amd64 and ia32_on_win64 cpus and
diff --git a/tests/util.test b/tests/util.test
index fe94732..9341047 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 2002/01/02 13:52:04 dkf Exp $
+# RCS: @(#) $Id: util.test,v 1.10.4.1 2003/08/27 17:56:46 dgp Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
@@ -300,6 +300,12 @@ set tcl_precision 12
# This test always succeeded in the C locale anyway...
test util-8.1 {TclNeedSpace - correct UTF8 handling} {
+ # Bug 411825
+ # Note that this test relies on the fact that
+ # [interp target] calls on Tcl_AppendElement()
+ # which calls on TclNeedSpace(). If [interp target]
+ # is ever updated, this test will no longer test
+ # TclNeedSpace.
interp create \u5420
interp create [list \u5420 foo]
interp alias {} fooset [list \u5420 foo] set
@@ -308,6 +314,35 @@ test util-8.1 {TclNeedSpace - correct UTF8 handling} {
set result
} "\u5420 foo"
+set ::tcltest::testConstraints(testdstring) \
+ [expr {[info commands testdstring] != {}}]
+
+test util-8.2 {TclNeedSpace - correct UTF8 handling} testdstring {
+ # Bug 411825
+ # This tests the same bug as the previous test, but
+ # should be more future-proof, as the DString
+ # operations will likely continue to call TclNeedSpace
+ testdstring free
+ testdstring append \u5420 -1
+ testdstring element foo
+ llength [testdstring get]
+} 2
+test util-8.3 {TclNeedSpace - correct UTF8 handling} testdstring {
+ # Bug 411825 - new variant reported by Dossy Shiobara
+ testdstring free
+ testdstring append \u00A0 -1
+ testdstring element foo
+ llength [testdstring get]
+} 2
+test util-8.4 {TclNeedSpace - correct UTF8 handling} testdstring {
+ # Another bug uncovered while fixing 411825
+ testdstring free
+ testdstring append {\ } -1
+ testdstring append \{ -1
+ testdstring element foo
+ llength [testdstring get]
+} 2
+
# cleanup
::tcltest::cleanupTests
return