summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2022-06-15 12:46:04 (GMT)
committerdgp <dgp@users.sourceforge.net>2022-06-15 12:46:04 (GMT)
commit02669f7c03cc5f1721b325bd7d66ed88d9952f2e (patch)
treef282872cd49b2f2076674160c0c4c4344f153120
parent9b1a7da59be393b5b4695631cadf5423a3c87a7d (diff)
parentd2cb5714faa8e3c9f583924a3f9a345d915aadd9 (diff)
downloadtcl-02669f7c03cc5f1721b325bd7d66ed88d9952f2e.zip
tcl-02669f7c03cc5f1721b325bd7d66ed88d9952f2e.tar.gz
tcl-02669f7c03cc5f1721b325bd7d66ed88d9952f2e.tar.bz2
merge 8.6
-rw-r--r--.fossil-settings/ignore-glob3
-rw-r--r--.gitignore3
-rw-r--r--generic/tclTestObj.c20
-rw-r--r--tests/listObj.test10
-rw-r--r--tests/stringObj.test25
5 files changed, 55 insertions, 6 deletions
diff --git a/.fossil-settings/ignore-glob b/.fossil-settings/ignore-glob
index 651d616..306d5a5 100644
--- a/.fossil-settings/ignore-glob
+++ b/.fossil-settings/ignore-glob
@@ -24,7 +24,8 @@
*/versions.vc
*/version.vc
*/libtcl.vfs
-*/libtcl_*.zip
+*/libtcl*.zip
+*/tclUuid.h
html
libtommath/bn.ilg
libtommath/bn.ind
diff --git a/.gitignore b/.gitignore
index 33579cf..74bf502 100644
--- a/.gitignore
+++ b/.gitignore
@@ -30,7 +30,8 @@ _FOSSIL_
*/versions.vc
*/version.vc
*/libtcl.vfs
-*/libtcl_*.zip
+*/libtcl*.zip
+*/tclUuid.h
libtommath/bn.ilg
libtommath/bn.ind
libtommath/pretty.build
diff --git a/generic/tclTestObj.c b/generic/tclTestObj.c
index 3fe9d02..b1a0afa 100644
--- a/generic/tclTestObj.c
+++ b/generic/tclTestObj.c
@@ -1184,7 +1184,7 @@ TeststringobjCmd(
Tcl_Obj **varPtr;
static const char *const options[] = {
"append", "appendstrings", "get", "get2", "length", "length2",
- "set", "set2", "setlength", "maxchars", "getunicode",
+ "set", "set2", "setlength", "maxchars", "range", "getunicode",
"appendself", "appendself2", NULL
};
@@ -1350,13 +1350,25 @@ TeststringobjCmd(
}
Tcl_SetIntObj(Tcl_GetObjResult(interp), length);
break;
- case 10: /* getunicode */
+ case 10: { /* range */
+ int first, last;
+ if (objc != 5) {
+ goto wrongNumArgs;
+ }
+ if ((Tcl_GetIntFromObj(interp, objv[3], &first) != TCL_OK)
+ || (Tcl_GetIntFromObj(interp, objv[4], &last) != TCL_OK)) {
+ return TCL_ERROR;
+ }
+ Tcl_SetObjResult(interp, Tcl_GetRange(varPtr[varIndex], first, last));
+ break;
+ }
+ case 11: /* getunicode */
if (objc != 3) {
goto wrongNumArgs;
}
Tcl_GetUnicodeFromObj(varPtr[varIndex], NULL);
break;
- case 11: /* appendself */
+ case 12: /* appendself */
if (objc != 4) {
goto wrongNumArgs;
}
@@ -1387,7 +1399,7 @@ TeststringobjCmd(
Tcl_AppendToObj(varPtr[varIndex], string + i, length - i);
Tcl_SetObjResult(interp, varPtr[varIndex]);
break;
- case 12: /* appendself2 */
+ case 13: /* appendself2 */
if (objc != 4) {
goto wrongNumArgs;
}
diff --git a/tests/listObj.test b/tests/listObj.test
index ce6c978..d60f13f 100644
--- a/tests/listObj.test
+++ b/tests/listObj.test
@@ -195,6 +195,16 @@ test listobj-10.1 {Bug [2971669]} {*}{
}
-result {{a b c d e} {} {a b c d e f}}
}
+test listobj-10.2 {Tcl_ListObjReplace with negative start value} testobj {
+ testlistobj set 1 a b c d e
+ testlistobj replace 1 -1 2 f
+ testlistobj get 1
+} {f c d e}
+test listobj-10.3 {Tcl_ListObjReplace with negative count value} testobj {
+ testlistobj set 1 a b c d e
+ testlistobj replace 1 1 -1 f
+ testlistobj get 1
+} {a f b c d e}
test listobj-11.1 {Bug 3598580: Tcl_ListObjReplace refcount management} testobj {
testobj bug3598580
diff --git a/tests/stringObj.test b/tests/stringObj.test
index bfe9da1..b799828 100644
--- a/tests/stringObj.test
+++ b/tests/stringObj.test
@@ -481,6 +481,31 @@ test stringObj-15.8 {Tcl_Append*ToObj: self appends} testobj {
teststringobj appendself2 1 3
} foo
+test stringObj-16.0 {Tcl_GetRange: normal case} testobj {
+ teststringobj set 1 abcde
+ teststringobj range 1 1 3
+} bcd
+test stringObj-16.1 {Tcl_GetRange: first > end} testobj {
+ teststringobj set 1 abcde
+ teststringobj range 1 10 5
+} {}
+test stringObj-16.2 {Tcl_GetRange: last > end} testobj {
+ teststringobj set 1 abcde
+ teststringobj range 1 3 13
+} de
+test stringObj-16.3 {Tcl_GetRange: first = -1} testobj {
+ teststringobj set 1 abcde
+ teststringobj range 1 -1 3
+} abcd
+test stringObj-16.4 {Tcl_GetRange: last = -1} testobj {
+ teststringobj set 1 abcde
+ teststringobj range 1 1 -1
+} bcde
+test stringObj-16.5 {Tcl_GetRange: fist = last = -1} testobj {
+ teststringobj set 1 abcde
+ teststringobj range 1 -1 -1
+} abcde
+
if {[testConstraint testobj]} {
testobj freeallvars