summaryrefslogtreecommitdiffstats
path: root/generic/tclTest.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2020-04-07 21:49:02 (GMT)
committerdgp <dgp@users.sourceforge.net>2020-04-07 21:49:02 (GMT)
commitbf7064c9adf77f3184dc5efcaa49e8d05da728cf (patch)
treec358d049477a929af2708ca8ef9794e79e81a656 /generic/tclTest.c
parentfe515177dd3f500c04c593db04baa6a8735ecd3b (diff)
downloadtcl-bf7064c9adf77f3184dc5efcaa49e8d05da728cf.zip
tcl-bf7064c9adf77f3184dc5efcaa49e8d05da728cf.tar.gz
tcl-bf7064c9adf77f3184dc5efcaa49e8d05da728cf.tar.bz2
Convert the tests to use the testing command.
Diffstat (limited to 'generic/tclTest.c')
-rw-r--r--generic/tclTest.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/generic/tclTest.c b/generic/tclTest.c
index bfed72e..506cef9 100644
--- a/generic/tclTest.c
+++ b/generic/tclTest.c
@@ -7114,20 +7114,24 @@ TestUtfPrevCmd(
const char *result;
Tcl_Obj *copy;
- if (objc != 3) {
- Tcl_WrongNumArgs(interp, 1, objv, "bytes offset");
+ if (objc < 2 || objc > 3) {
+ Tcl_WrongNumArgs(interp, 1, objv, "bytes ?offset?");
return TCL_ERROR;
}
bytes = (char *) Tcl_GetByteArrayFromObj(objv[1], &numBytes);
- if (TCL_OK != Tcl_GetIntFromObj(interp, objv[2], &offset)) {
- return TCL_ERROR;
- }
- if (offset < 0) {
- offset = 0;
- }
- if (offset > numBytes) {
+ if (objc == 3) {
+ if (TCL_OK != Tcl_GetIntFromObj(interp, objv[2], &offset)) {
+ return TCL_ERROR;
+ }
+ if (offset < 0) {
+ offset = 0;
+ }
+ if (offset > numBytes) {
+ offset = numBytes;
+ }
+ } else {
offset = numBytes;
}
copy = Tcl_DuplicateObj(objv[1]);