summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2020-11-18 09:49:08 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2020-11-18 09:49:08 (GMT)
commitf7b532246a185fd8f314fdf9969a4a58533f90bc (patch)
treee1a41170231898872e6d5a19966a1b6b98c0f2cf
parentc4b8fd351a05b85eebddb6def0955884e6929e65 (diff)
downloadtcl-f7b532246a185fd8f314fdf9969a4a58533f90bc.zip
tcl-f7b532246a185fd8f314fdf9969a4a58533f90bc.tar.gz
tcl-f7b532246a185fd8f314fdf9969a4a58533f90bc.tar.bz2
Enhance misleading test-case utf-6.23 with better diagnostics: Byte 0xE8 is the start of a 3-byte UTF-8 sequence, so Tcl_UtfNext is expected to read next byte and see if it is a continuation byte
-rw-r--r--generic/tclTest.c6
-rw-r--r--tests/utf.test12
2 files changed, 10 insertions, 8 deletions
diff --git a/generic/tclTest.c b/generic/tclTest.c
index 6923cd6..6408228 100644
--- a/generic/tclTest.c
+++ b/generic/tclTest.c
@@ -7184,8 +7184,10 @@ TestUtfNextCmd(
/* Run Tcl_UtfNext with many more possible bytes at src[end], all should give the same result */
result = TclUtfNext(buffer + 1);
if (first != result) {
- first = buffer;
- break;
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "Tcl_UtfNext is not supposed to read src[end]\n"
+ "Different result when src[end] is %#x", UCHAR(p[-1])));
+ return TCL_ERROR;
}
}
diff --git a/tests/utf.test b/tests/utf.test
index a32b19e..c61082f 100644
--- a/tests/utf.test
+++ b/tests/utf.test
@@ -252,8 +252,8 @@ test utf-6.22 {Tcl_UtfNext} {testutfnext testbytestring} {
testutfnext [testbytestring \xD0\xF8]
} 1
test utf-6.23 {Tcl_UtfNext} {testutfnext testbytestring} {
- testutfnext [testbytestring \xE8]
-} -1
+ testutfnext [testbytestring \xE8\x00]
+} 1
test utf-6.24 {Tcl_UtfNext} {testutfnext testbytestring} {
testutfnext [testbytestring \xE8]G
} 1
@@ -276,8 +276,8 @@ test utf-6.30.0 {Tcl_UtfNext} {testutfnext testbytestring ucs2} {
testutfnext [testbytestring \xF2]
} 1
test utf-6.30.1 {Tcl_UtfNext} {testutfnext testbytestring fullutf} {
- testutfnext [testbytestring \xF2]
-} -1
+ testutfnext [testbytestring \xF2\x00]
+} 1
test utf-6.31 {Tcl_UtfNext} {testutfnext testbytestring} {
testutfnext [testbytestring \xF2]G
} 1
@@ -285,8 +285,8 @@ test utf-6.32.0 {Tcl_UtfNext} {testutfnext testbytestring ucs2} {
testutfnext [testbytestring \xF2\xA0]
} 1
test utf-6.32.1 {Tcl_UtfNext} {testutfnext testbytestring fullutf} {
- testutfnext [testbytestring \xF2\xA0]
-} -1
+ testutfnext [testbytestring \xF2\xA0\x00]
+} 1
test utf-6.33 {Tcl_UtfNext} {testutfnext testbytestring} {
testutfnext [testbytestring \xF2\xD0]
} 1