From 0755cf021f50f333d57722d4ad590e0908c931fd Mon Sep 17 00:00:00 2001 From: ericm Date: Wed, 28 Jun 2000 18:11:20 +0000 Subject: * tests/stringObj.test: Tweaked tests to avoid hardcoded high-ASCII characters (which will fail in multibyte locales); instead used \uXXXX syntax. [Bug: 3842]. FossilOrigin-Name: e273f9d105056aaac8e59357293e899bb5e382f5 --- ChangeLog | 6 ++++++ tests/stringObj.test | 39 ++++++++++++++++++++++++++++++--------- 2 files changed, 36 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 68cb1d4..4dab71c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2000-06-27 Eric Melski + + * tests/stringObj.test: Tweaked tests to avoid hardcoded + high-ASCII characters (which will fail in multibyte locales); + instead used \uXXXX syntax. [Bug: 3842]. + 2000-06-26 Eric Melski * doc/package.n: Corrected information about [package forget] diff --git a/tests/stringObj.test b/tests/stringObj.test index 458b2f8..115ba2c 100644 --- a/tests/stringObj.test +++ b/tests/stringObj.test @@ -12,7 +12,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: stringObj.test,v 1.10 2000/04/10 17:19:04 ericm Exp $ +# RCS: @(#) $Id: stringObj.test,v 1.11 2000/06/28 18:11:21 ericm Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -321,27 +321,42 @@ test stringObj-10.1 {Tcl_GetRange with all byte-size chars} { set x "abcdef" list [testobj objtype $x] [set y [string range $x 1 end-1]] \ [testobj objtype $x] [testobj objtype $y] -} {none bcde string string} +} [list none bcde string string] test stringObj-10.2 {Tcl_GetRange with some mixed width chars} { + # Because this test does not use \uXXXX notation below instead of + # hardcoding the values, it may fail in multibyte locales. However, + # we need to test that the parser produces untyped objects even when there + # are high-ASCII characters in the input (like "ï"). I don't know what + # else to do but inline those characters here. set x "abcïïdef" list [testobj objtype $x] [set y [string range $x 1 end-1]] \ [testobj objtype $x] [testobj objtype $y] -} {none bcïïde string string} +} [list none "bc\u00EF\u00EFde" string string] test stringObj-10.3 {Tcl_GetRange with some mixed width chars} { - set x "abcïïdef" + # set x "abcïïdef" + # Use \uXXXX notation below instead of hardcoding the values, otherwise + # the test will fail in multibyte locales. + set x "abc\u00EF\u00EFdef" string length $x list [testobj objtype $x] [set y [string range $x 1 end-1]] \ [testobj objtype $x] [testobj objtype $y] -} {string bcïïde string string} +} [list string "bc\u00EF\u00EFde" string string] test stringObj-10.4 {Tcl_GetRange with some mixed width chars} { - set a "ïa¿b®cï¿d®" + # set a "ïa¿b®cï¿d®" + # Use \uXXXX notation below instead of hardcoding the values, otherwise + # the test will fail in multibyte locales. + set a "\u00EFa\u00BFb\u00AEc\u00EF\u00BFd\u00AE" set result [list] while {[string length $a] > 0} { set a [string range $a 1 end-1] lappend result $a } set result -} {a¿b®cï¿d ¿b®cï¿ b®cï ®c {}} +} [list a\u00BFb\u00AEc\u00EF\u00BFd \ + \u00BFb\u00AEc\u00EF\u00BF \ + b\u00AEc\u00EF \ + \u00AEc \ + {}] test stringObj-11.1 {UpdateStringOfString} { set x 2345 @@ -387,10 +402,16 @@ test stringObj-13.4 {Tcl_GetCharLength with mixed width chars} { string length "®" } 1 test stringObj-13.5 {Tcl_GetCharLength with mixed width chars} { - string length "○○" + # string length "○○" + # Use \uXXXX notation below instead of hardcoding the values, otherwise + # the test will fail in multibyte locales. + string length "\u00EF\u00BF\u00AE\u00EF\u00BF\u00AE" } 6 test stringObj-13.6 {Tcl_GetCharLength with mixed width chars} { - set a "ïa¿b®cï¿d®" + # set a "ïa¿b®cï¿d®" + # Use \uXXXX notation below instead of hardcoding the values, otherwise + # the test will fail in multibyte locales. + set a "\u00EFa\u00BFb\u00AEc\u00EF\u00BFd\u00AE" list [string length $a] [string length $a] } {10 10} -- cgit v0.12