From 57d80b8062bd84389ce200cf7fd42c52b5466b07 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Sun, 5 Apr 2020 20:11:49 +0000 Subject: Revert test-case utf-4.10 change from previous commit: It caused the Travis build failure. Change the testnumutfchars command to accept "end+1" as lenght, in which case it will count the ending null-byte too, as test-case 4.10 demands. --- generic/tclTest.c | 8 +++++--- tests/utf.test | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/generic/tclTest.c b/generic/tclTest.c index f63f891..e187ec2 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -6809,9 +6809,11 @@ TestNumUtfCharsCmd( const char *bytes = Tcl_GetStringFromObj(objv[1], &numBytes); if (objc > 2) { - (void) Tcl_GetIntFromObj(interp, objv[2], &limit); - if (limit > numBytes) { - limit = numBytes; + if (TclGetIntForIndex(interp, objv[2], numBytes, &limit) != TCL_OK) { + return TCL_ERROR; + } + if (limit > numBytes + 1) { + limit = numBytes + 1; } } len = Tcl_NumUtfChars(bytes, limit); diff --git a/tests/utf.test b/tests/utf.test index 5cd2277..2e4882d 100644 --- a/tests/utf.test +++ b/tests/utf.test @@ -137,7 +137,7 @@ test utf-4.9 {Tcl_NumUtfChars: #u20AC, calc len, incomplete} {testnumutfchars te testnumutfchars [testbytestring "\xE2\x82\xAC"] 2 } {2} test utf-4.10 {Tcl_NumUtfChars: #u0000, calc len, overcomplete} {testnumutfchars testbytestring} { - testnumutfchars [testbytestring "\x00"] 1 + testnumutfchars [testbytestring "\x00"] 2 } {2} test utf-5.1 {Tcl_UtfFindFirst} {testfindfirst testbytestring} { -- cgit v0.12