summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2003-08-27 17:57:03 (GMT)
committerdgp <dgp@users.sourceforge.net>2003-08-27 17:57:03 (GMT)
commit769035280578d490045479f9cbae23e6fef5ab7c (patch)
treeff6a704b0167c71c1318cb2cf5e7e3126b14a5b3 /tests
parent263dffb9a8b33fe58a55b0c6c606c88b4d880131 (diff)
downloadtcl-769035280578d490045479f9cbae23e6fef5ab7c.zip
tcl-769035280578d490045479f9cbae23e6fef5ab7c.tar.gz
tcl-769035280578d490045479f9cbae23e6fef5ab7c.tar.bz2
* tests/util.test: Added new tests for remaining TclNeedSpace()
bugs discussed in [Bug 411825].
Diffstat (limited to 'tests')
-rw-r--r--tests/util.test37
1 files changed, 36 insertions, 1 deletions
diff --git a/tests/util.test b/tests/util.test
index 22b1dbc..ddba3e4 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.11 2003/07/24 16:05:24 dgp Exp $
+# RCS: @(#) $Id: util.test,v 1.12 2003/08/27 17:57:03 dgp Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
@@ -333,6 +333,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
@@ -341,6 +347,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