From 88bf24e7cb31b621f6232bbe780c1ea64a5c77cc Mon Sep 17 00:00:00 2001
From: dgp <dgp@users.sourceforge.net>
Date: Mon, 9 Jun 2003 21:51:55 +0000
Subject:         * 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.

---
 ChangeLog         | 6 ++++++
 tests/string.test | 9 ++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index b7ebd8e..a05d6c3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2003-06-09  Don Porter  <dgp@users.sourceforge.net>
+
+        * 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.
+
 2003-06-04  Joe Mistachkin  <joe@mistachkin.com>
 
         * tools/man2help.tcl: Added duplicate help section checking           
diff --git a/tests/string.test b/tests/string.test
index f1ba56d..6e937f4 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.36.2.1 2003/04/11 20:49:54 dgp Exp $
+# RCS: @(#) $Id: string.test,v 1.36.2.2 2003/06/09 21:51:56 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
-- 
cgit v0.12