summaryrefslogtreecommitdiffstats
path: root/tests/string.test
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2003-06-09 21:51:36 (GMT)
committerdgp <dgp@users.sourceforge.net>2003-06-09 21:51:36 (GMT)
commita8853bfaf368294f76dbe7dba99f5f111377f618 (patch)
tree5b86566a168f07b11d780b02732e1d8f27eb9d75 /tests/string.test
parentd957ac0939a46479bf11a785dcf44c3bfa5d9eef (diff)
downloadtcl-a8853bfaf368294f76dbe7dba99f5f111377f618.zip
tcl-a8853bfaf368294f76dbe7dba99f5f111377f618.tar.gz
tcl-a8853bfaf368294f76dbe7dba99f5f111377f618.tar.bz2
* string.test (string-4.15): Added test for [string first] bug
reported in Tcl 8.3, where test for all-single-byte-encoded strings was not reliable.
Diffstat (limited to 'tests/string.test')
-rw-r--r--tests/string.test9
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/string.test b/tests/string.test
index 89ece02..40e84ed 100644
--- a/tests/string.test
+++ b/tests/string.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: string.test,v 1.37 2003/04/11 20:50:47 dgp Exp $
+# RCS: @(#) $Id: string.test,v 1.38 2003/06/09 21:51:37 dgp Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
@@ -213,6 +213,13 @@ test string-4.13 {string first, start index} {
test string-4.14 {string first, negative start index} {
string first b abc -1
} 1
+test string-4.15 {string first, ability to two-byte encoded utf-8 chars} {
+ # Test for a bug in Tcl 8.3 where test for all-single-byte-encoded
+ # strings was incorrect, leading to an index returned by [string first]
+ # which pointed past the end of the string.
+ set uchar \u057e ;# character with two-byte encoding in utf-8
+ string first % %#$uchar$uchar#$uchar$uchar#% 3
+} 8
test string-5.1 {string index} {
list [catch {string index} msg] $msg