Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Expand AbstractList regression testing. |
|---|---|
| Timelines: | family | ancestors | descendants | both | tip-636 |
| Files: | files | file ages | folders |
| SHA3-256: |
23eb27dc8942df728c2493d3e1834f15 |
| User & Date: | griffin 2022-10-28 06:13:11.560 |
Context
|
2022-10-28
| ||
| 18:53 | Sync with core-8-branch check-in: 13f6bc6ac8 user: griffin tags: tip-636 | |
| 06:13 | Expand AbstractList regression testing. check-in: 23eb27dc89 user: griffin tags: tip-636 | |
|
2022-10-25
| ||
| 02:30 | Sync with core-8-branch check-in: 38481cf1fb user: griffin tags: tip-636 | |
Changes
Changes to generic/tclCmdIL.c.
| ︙ | ︙ | |||
4384 4385 4386 4387 4388 4389 4390 |
}
/*
* Substitute the value in the value. Return either the value or else an
* unshared copy of it.
*/
| < | | 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 |
}
/*
* Substitute the value in the value. Return either the value or else an
* unshared copy of it.
*/
if (TclAbstractListHasProc(listPtr, TCL_ABSL_SETELEMENT) &&
objc == 4) {
finalValuePtr = Tcl_AbstractListSetElement(interp, listPtr, objv[2], objv[3]);
if (finalValuePtr) Tcl_IncrRefCount(finalValuePtr);
} else if (objc == 4) {
finalValuePtr = TclLsetList(interp, listPtr, objv[2], objv[3]);
} else {
finalValuePtr = TclLsetFlat(interp, listPtr, objc-3, objv+2,
|
| ︙ | ︙ |
Changes to generic/tclTestABSList.c.
1 2 3 4 5 6 7 8 9 10 11 | // Tcl Abstract List test command: "lstring" #include <string.h> #include <limits.h> #include "tcl.h" /* * Forward references */ Tcl_Obj *myNewLStringObj(Tcl_WideInt start, Tcl_WideInt length); | > | 1 2 3 4 5 6 7 8 9 10 11 12 | // Tcl Abstract List test command: "lstring" #include <string.h> #include <limits.h> #include "tcl.h" #include "tclAbstractList.h" /* * Forward references */ Tcl_Obj *myNewLStringObj(Tcl_WideInt start, Tcl_WideInt length); |
| ︙ | ︙ | |||
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
Tcl_Obj **newObjPtr);
static int my_LStringReplace(Tcl_Interp *interp,
Tcl_Obj *listObj,
Tcl_WideInt first,
Tcl_WideInt numToDelete,
Tcl_WideInt numToInsert,
Tcl_Obj *const insertObjs[]);
/*
* Internal Representation of an lstring type value
*/
typedef struct LString {
char *string; // NULL terminated utf-8 string
Tcl_WideInt strlen; // num bytes in string
Tcl_WideInt allocated; // num bytes allocated
} LString;
/*
* AbstractList definition of an lstring type
*/
| > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | < | | | 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 |
Tcl_Obj **newObjPtr);
static int my_LStringReplace(Tcl_Interp *interp,
Tcl_Obj *listObj,
Tcl_WideInt first,
Tcl_WideInt numToDelete,
Tcl_WideInt numToInsert,
Tcl_Obj *const insertObjs[]);
static int my_LStringGetElements(Tcl_Interp *interp,
Tcl_Obj *listPtr,
int *objcptr,
Tcl_Obj ***objvptr);
/*
* Internal Representation of an lstring type value
*/
typedef struct LString {
char *string; // NULL terminated utf-8 string
Tcl_WideInt strlen; // num bytes in string
Tcl_WideInt allocated; // num bytes allocated
Tcl_Obj**elements; // elements array, allocated when GetElements is
// called
} LString;
/*
* AbstractList definition of an lstring type
*/
static Tcl_AbstractListType lstringTypes[12] = {
{
TCL_ABSTRACTLIST_VERSION_1,
"lstring",
/**/ NULL, /*default NULL,*/
DupLStringRep,
my_LStringObjLength,
my_LStringObjIndex,
my_LStringObjRange,/*ObjRange*/
my_LStringObjReverse,
my_LStringGetElements,
freeRep,
NULL /*toString*/,
my_LStringObjSetElem, /* use default update string */
my_LStringReplace
},
{
TCL_ABSTRACTLIST_VERSION_1,
"lstring",
NULL,
/**/ NULL, /*default DupLStringRep,*/
my_LStringObjLength,
my_LStringObjIndex,
my_LStringObjRange,/*ObjRange*/
my_LStringObjReverse,
my_LStringGetElements,
freeRep,
NULL /*toString*/,
my_LStringObjSetElem, /* use default update string */
my_LStringReplace
},
{
TCL_ABSTRACTLIST_VERSION_1,
"lstring",
NULL,
DupLStringRep,
/**/ NULL, /*default my_LStringObjLength,*/
my_LStringObjIndex,
my_LStringObjRange,/*ObjRange*/
my_LStringObjReverse,
my_LStringGetElements,
freeRep,
NULL /*toString*/,
my_LStringObjSetElem, /* use default update string */
my_LStringReplace
},
{
TCL_ABSTRACTLIST_VERSION_1,
"lstring",
NULL,
DupLStringRep,
my_LStringObjLength,
/**/ NULL, /*default my_LStringObjIndex,*/
my_LStringObjRange,/*ObjRange*/
my_LStringObjReverse,
my_LStringGetElements,
freeRep,
NULL /*toString*/,
my_LStringObjSetElem, /* use default update string */
my_LStringReplace
},
{
TCL_ABSTRACTLIST_VERSION_1,
"lstring",
NULL,
DupLStringRep,
my_LStringObjLength,
my_LStringObjIndex,
/**/ NULL, /*default my_LStringObjRange,*/
my_LStringObjReverse,
my_LStringGetElements,
freeRep,
NULL /*toString*/,
my_LStringObjSetElem, /* use default update string */
my_LStringReplace
},
{
TCL_ABSTRACTLIST_VERSION_1,
"lstring",
NULL,
DupLStringRep,
my_LStringObjLength,
my_LStringObjIndex,
my_LStringObjRange,/*ObjRange*/
/**/ NULL, /*defaults my_LStringObjReverse,*/
my_LStringGetElements,
freeRep,
NULL /*toString*/,
my_LStringObjSetElem, /* use default update string */
my_LStringReplace
},
{
TCL_ABSTRACTLIST_VERSION_1,
"lstring",
NULL,
DupLStringRep,
my_LStringObjLength,
my_LStringObjIndex,
my_LStringObjRange,/*ObjRange*/
my_LStringObjReverse,
/**/ NULL, /*default NULL / *my_LStringGetElements,*/
freeRep,
NULL /*toString*/,
my_LStringObjSetElem, /* use default update string */
my_LStringReplace
},
{
TCL_ABSTRACTLIST_VERSION_1,
"lstring",
NULL,
DupLStringRep,
my_LStringObjLength,
my_LStringObjIndex,
my_LStringObjRange,/*ObjRange*/
my_LStringObjReverse,
my_LStringGetElements,
/**/ NULL, /*default freeRep,*/
NULL /*toString*/,
my_LStringObjSetElem, /* use default update string */
my_LStringReplace
},
{
TCL_ABSTRACTLIST_VERSION_1,
"lstring",
NULL,
DupLStringRep,
my_LStringObjLength,
my_LStringObjIndex,
my_LStringObjRange,/*ObjRange*/
my_LStringObjReverse,
my_LStringGetElements,
freeRep,
/**/ NULL, /*toString*/
my_LStringObjSetElem, /* use default update string */
my_LStringReplace
},
{
TCL_ABSTRACTLIST_VERSION_1,
"lstring",
NULL,
DupLStringRep,
my_LStringObjLength,
my_LStringObjIndex,
my_LStringObjRange,/*ObjRange*/
my_LStringObjReverse,
my_LStringGetElements,
freeRep,
NULL /*toString*/,
/**/ NULL, /*default my_LStringObjSetElem, / * use default update string */
NULL, /*default my_LStringReplace*/
},
{
TCL_ABSTRACTLIST_VERSION_1,
"lstring",
NULL,
DupLStringRep,
my_LStringObjLength,
my_LStringObjIndex,
my_LStringObjRange,/*ObjRange*/
my_LStringObjReverse,
my_LStringGetElements,
freeRep,
NULL /*toString*/,
my_LStringObjSetElem, /* use default update string */
/**/ NULL, /*default my_LStringReplace*/
},
{
TCL_ABSTRACTLIST_VERSION_1,
"lstring",
NULL,
DupLStringRep,
my_LStringObjLength,
my_LStringObjIndex,
my_LStringObjRange,/*ObjRange*/
my_LStringObjReverse,
my_LStringGetElements,
freeRep,
NULL /*toString*/,
my_LStringObjSetElem, /* use default update string */
my_LStringReplace
}
};
/*
*----------------------------------------------------------------------
*
* my_LStringObjIndex --
*
|
| ︙ | ︙ | |||
154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
{
LString *srcLString = (LString*)Tcl_AbstractListGetConcreteRep(srcPtr);
LString *copyLString = (LString*)Tcl_Alloc(sizeof(LString));
memcpy(copyLString, srcLString, sizeof(LString));
copyLString->string = (char*)Tcl_Alloc(srcLString->allocated);
strcpy(copyLString->string, srcLString->string);
Tcl_AbstractListSetConcreteRep(copyPtr,copyLString);
return;
}
/*
*----------------------------------------------------------------------
| > | 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 |
{
LString *srcLString = (LString*)Tcl_AbstractListGetConcreteRep(srcPtr);
LString *copyLString = (LString*)Tcl_Alloc(sizeof(LString));
memcpy(copyLString, srcLString, sizeof(LString));
copyLString->string = (char*)Tcl_Alloc(srcLString->allocated);
strcpy(copyLString->string, srcLString->string);
copyLString->elements = NULL;
Tcl_AbstractListSetConcreteRep(copyPtr,copyLString);
return;
}
/*
*----------------------------------------------------------------------
|
| ︙ | ︙ | |||
264 265 266 267 268 269 270 |
if ((fromIdx < 0 || lstringRepPtr->strlen < fromIdx) ||
(toIdx < 0 || lstringRepPtr->strlen < toIdx)) {
Tcl_SetObjResult(interp,
Tcl_ObjPrintf("Range out of bounds "));
return TCL_ERROR;
}
| < < > > | 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 |
if ((fromIdx < 0 || lstringRepPtr->strlen < fromIdx) ||
(toIdx < 0 || lstringRepPtr->strlen < toIdx)) {
Tcl_SetObjResult(interp,
Tcl_ObjPrintf("Range out of bounds "));
return TCL_ERROR;
}
if (len <= 0) {
// Return empty value;
*newObjPtr = Tcl_NewObj();
} else {
rangeRep = (LString*)Tcl_Alloc(sizeof(LString));
rangeRep->allocated = len+1;
rangeRep->strlen = len;
rangeRep->string = (char*)Tcl_Alloc(rangeRep->allocated);
strncpy(rangeRep->string,&lstringRepPtr->string[fromIdx],len);
rangeRep->string[len] = 0;
rangeRep->elements = NULL;
rangeObj = Tcl_AbstractListObjNew(interp, Tcl_AbstractListGetType(lstringObj));
Tcl_AbstractListSetConcreteRep(rangeObj, rangeRep);
*newObjPtr = rangeObj;
}
return TCL_OK;
}
/*
|
| ︙ | ︙ | |||
302 303 304 305 306 307 308 |
*
*----------------------------------------------------------------------
*/
static int
my_LStringObjReverse(Tcl_Interp *interp, Tcl_Obj *srcObj, Tcl_Obj **newObjPtr)
{
| < > > > | 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 |
*
*----------------------------------------------------------------------
*/
static int
my_LStringObjReverse(Tcl_Interp *interp, Tcl_Obj *srcObj, Tcl_Obj **newObjPtr)
{
LString *srcRep = (LString*)Tcl_AbstractListGetConcreteRep(srcObj);
Tcl_Obj *revObj;
LString *revRep = (LString*)Tcl_Alloc(sizeof(LString));
Tcl_WideInt len;
char *srcp, *dstp, *endp;
len = srcRep->strlen;
revRep->strlen = len;
revRep->allocated = len+1;
revRep->string = (char*)Tcl_Alloc(revRep->allocated);
revRep->elements = NULL;
srcp = srcRep->string;
endp = &srcRep->string[len];
dstp = &revRep->string[len];
*dstp-- = 0;
while (srcp < endp) {
*dstp-- = *srcp++;
}
revObj = Tcl_AbstractListObjNew(interp, Tcl_AbstractListGetType(srcObj));
Tcl_AbstractListSetConcreteRep(revObj, revRep);
*newObjPtr = revObj;
return TCL_OK;
}
/*
*----------------------------------------------------------------------
|
| ︙ | ︙ | |||
434 435 436 437 438 439 440 441 442 443 444 445 446 447 |
lstringRep->strlen = newLen;
/* Changes made to value, string rep no longer valid */
Tcl_InvalidateStringRep(listObj);
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
* my_NewLStringObj --
*
* Creates a new lstring Obj using the string value of objv[0]
| > > > > > > > > > > > | 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 |
lstringRep->strlen = newLen;
/* Changes made to value, string rep no longer valid */
Tcl_InvalidateStringRep(listObj);
return TCL_OK;
}
static Tcl_AbstractListType *
my_SetAbstractProc(Tcl_AbstractListProcType ptype)
{
Tcl_AbstractListType *typePtr = &lstringTypes[11];
if (TCL_ABSL_NEW <= ptype && ptype <= TCL_ABSL_REPLACE) {
typePtr = &lstringTypes[ptype];
}
return typePtr;
}
/*
*----------------------------------------------------------------------
*
* my_NewLStringObj --
*
* Creates a new lstring Obj using the string value of objv[0]
|
| ︙ | ︙ | |||
461 462 463 464 465 466 467 468 |
int objc,
Tcl_Obj * const objv[])
{
LString *lstringRepPtr;
size_t repSize;
Tcl_Obj *lstringPtr;
const char *string;
| > > > > > > > > > > | > > > > > > > > > > > > > > > > > > | < | < > | 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 |
int objc,
Tcl_Obj * const objv[])
{
LString *lstringRepPtr;
size_t repSize;
Tcl_Obj *lstringPtr;
const char *string;
static const char* procTypeNames[] = {
"NEW", "DUPREP", "LENGTH", "INDEX",
"SLICE", "REVERSE", "GETELEMENTS", "FREEREP",
"TOSTRING", "SETELEMENT", "REPLACE", NULL
};
int i = 0;
Tcl_AbstractListProcType ptype;
Tcl_AbstractListType *lstringTypePtr = &lstringTypes[11];
repSize = sizeof(LString);
lstringRepPtr = (LString*)Tcl_Alloc(repSize);
while (i<objc) {
const char *s = Tcl_GetString(objv[i]);
if (strcmp(s, "-not")==0) {
i++;
if (Tcl_GetIndexFromObj(interp, objv[i], procTypeNames, "proctype", 0, &ptype)==TCL_OK) {
lstringTypePtr = my_SetAbstractProc(ptype);
}
} else if (strcmp(s, "--") == 0) {
// End of options
i++;
break;
} else {
break;
}
i++;
}
if (i != objc-1) {
Tcl_WrongNumArgs(interp, 0, objv, "lstring string");
return NULL;
}
string = Tcl_GetString(objv[i]);
lstringPtr = Tcl_AbstractListObjNew(interp, lstringTypePtr);
lstringRepPtr->strlen = strlen(string);
lstringRepPtr->allocated = lstringRepPtr->strlen + 1;
lstringRepPtr->string = (char*)Tcl_Alloc(lstringRepPtr->allocated);
strcpy(lstringRepPtr->string, string);
lstringRepPtr->elements = NULL;
Tcl_AbstractListSetConcreteRep(lstringPtr, lstringRepPtr);
if (lstringRepPtr->strlen > 0) {
Tcl_InvalidateStringRep(lstringPtr);
} else {
Tcl_InitStringRep(lstringPtr, NULL, 0);
}
|
| ︙ | ︙ | |||
506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 |
static void
freeRep(Tcl_Obj* lstringObj)
{
LString *lstringRepPtr = (LString*)Tcl_AbstractListGetConcreteRep(lstringObj);
if (lstringRepPtr->string) {
Tcl_Free(lstringRepPtr->string);
}
Tcl_Free((char*)lstringRepPtr);
Tcl_AbstractListSetConcreteRep(lstringObj, NULL);
}
/*
*----------------------------------------------------------------------
*
* lLStringObjCmd --
*
* Script level command that creats an lstring Obj value.
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 |
static void
freeRep(Tcl_Obj* lstringObj)
{
LString *lstringRepPtr = (LString*)Tcl_AbstractListGetConcreteRep(lstringObj);
if (lstringRepPtr->string) {
Tcl_Free(lstringRepPtr->string);
}
if (lstringRepPtr->elements) {
Tcl_Obj **objptr = lstringRepPtr->elements;
while (objptr < &lstringRepPtr->elements[lstringRepPtr->strlen]) {
Tcl_DecrRefCount(*objptr++);
}
Tcl_Free((char*)lstringRepPtr->elements);
lstringRepPtr->elements = NULL;
}
Tcl_Free((char*)lstringRepPtr);
Tcl_AbstractListSetConcreteRep(lstringObj, NULL);
}
/*
*----------------------------------------------------------------------
*
* my_LStringGetElements --
*
* Get the elements of the list in an array.
*
* Results:
* objc, objv return values
*
* Side effects:
* A Tcl_Obj is stored for every element of the abstract list
*
*----------------------------------------------------------------------
*/
static int my_LStringGetElements(Tcl_Interp *interp,
Tcl_Obj *lstringObj,
int *objcptr,
Tcl_Obj ***objvptr)
{
LString *lstringRepPtr = (LString*)Tcl_AbstractListGetConcreteRep(lstringObj);
Tcl_Obj **objPtr;
char *cptr = lstringRepPtr->string;
(void)interp;
if (lstringRepPtr->strlen == 0) {
*objcptr = 0;
*objvptr = NULL;
return TCL_OK;
}
if (lstringRepPtr->elements == NULL) {
lstringRepPtr->elements = (Tcl_Obj**)Tcl_Alloc(sizeof(Tcl_Obj*) * lstringRepPtr->strlen);
objPtr=lstringRepPtr->elements;
while (objPtr<&lstringRepPtr->elements[lstringRepPtr->strlen]) {
*objPtr = Tcl_NewStringObj(cptr++,1);
Tcl_IncrRefCount(*objPtr++);
}
}
*objvptr = lstringRepPtr->elements;
*objcptr = lstringRepPtr->strlen;
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
* lLStringObjCmd --
*
* Script level command that creats an lstring Obj value.
|
| ︙ | ︙ | |||
535 536 537 538 539 540 541 542 |
lLStringObjCmd(
void *clientData,
Tcl_Interp *interp,
int objc,
Tcl_Obj * const objv[])
{
Tcl_Obj *lstringObj;
(void)clientData;
| > | | 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 |
lLStringObjCmd(
void *clientData,
Tcl_Interp *interp,
int objc,
Tcl_Obj * const objv[])
{
Tcl_Obj *lstringObj;
(void)clientData;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "string");
return TCL_ERROR;
}
lstringObj = my_NewLStringObj(interp, objc-1, &objv[1]);
if (lstringObj) {
|
| ︙ | ︙ |
Changes to tests/abstractlist.test.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# Exercise AbstractList API via the "lstring" command defined in tclTestABSList.c
#
# Copyright © 2022 Brian Griffin
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
if {"::tcltest" ni [namespace children]} {
package require tcltest 2.5
namespace import -force ::tcltest::*
}
proc value-isa {var {expected ""}} {
upvar $var v
set t [lindex [tcl::unsupported::representation $v] 3]
if {$expected ne "" && $expected ne $t} {
set fail " expecting: $expected"
} else {
set fail ""
}
| > > | > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# Exercise AbstractList API via the "lstring" command defined in tclTestABSList.c
#
# Copyright © 2022 Brian Griffin
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
if {"::tcltest" ni [namespace children]} {
package require tcltest 2.5
namespace import -force ::tcltest::*
}
set abstractlisttestvars [info var *]
proc value-isa {var {expected ""}} {
upvar $var v
set t [lindex [tcl::unsupported::representation $v] 3]
if {$expected ne "" && $expected ne $t} {
set fail " expecting: $expected"
} else {
set fail ""
}
return "$var is a $t$fail"
}
proc value-cmp {vara varb} {
upvar $vara a
upvar $varb b
set ta [tcl::unsupported::representation $a]
set tb [tcl::unsupported::representation $b]
return [string compare $ta $tb]
}
set str "My name is Inigo Montoya. You killed my father. Prepare to die!"
set str2 "Vizzini: HE DIDN'T FALL? INCONCEIVABLE. Inigo Montoya: You keep using that word. I do not think it means what you think it means."
test abstractlist-1.0 {error cases} -body {
lstring
|
| ︙ | ︙ | |||
37 38 39 40 41 42 43 |
test abstractlist-2.0 {no shimmer llength} {
set l [lstring $str]
set l-isa [value-isa l]
set len [llength $l]
set l-isa2 [value-isa l]
list $l ${l-isa} ${len} ${l-isa2}
| | | | | | | < < | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 |
test abstractlist-2.0 {no shimmer llength} {
set l [lstring $str]
set l-isa [value-isa l]
set len [llength $l]
set l-isa2 [value-isa l]
list $l ${l-isa} ${len} ${l-isa2}
} {{M y { } n a m e { } i s { } I n i g o { } M o n t o y a . { } Y o u { } k i l l e d { } m y { } f a t h e r . { } P r e p a r e { } t o { } d i e !} {l is a lstring} 63 {l is a lstring}}
test abstractlist-2.1 {no shimmer lindex} {
set l [lstring $str]
set l-isa [value-isa l]
set ele [lindex $l 22]
set l-isa2 [value-isa l]
list $l ${l-isa} ${ele} ${l-isa2}
} {{M y { } n a m e { } i s { } I n i g o { } M o n t o y a . { } Y o u { } k i l l e d { } m y { } f a t h e r . { } P r e p a r e { } t o { } d i e !} {l is a lstring} y {l is a lstring}}
test abstractlist-2.2 {no shimmer lreverse} {
set l [lstring $str]
set l-isa [value-isa l]
set r [lreverse $l]
set r-isa [value-isa r]
set l-isa2 [value-isa l]
list $r ${l-isa} ${r-isa} ${l-isa2}
} {{! e i d { } o t { } e r a p e r P { } . r e h t a f { } y m { } d e l l i k { } u o Y { } . a y o t n o M { } o g i n I { } s i { } e m a n { } y M} {l is a lstring} {r is a lstring} {l is a lstring}}
test abstractlist-2.3 {no shimmer lrange} {
set l [lstring $str]
set l-isa [value-isa l]
set il [lsearch -all [lstring $str] { }]
set l-isa2 [value-isa l]
lappend il [llength $l]
set start 0
set words [lmap i $il {
set w [join [lrange $l $start $i-1] {} ]
set start [expr {$i+1}]
set w
}]
set l-isa3 [value-isa l]
list ${l-isa} $il ${l-isa2} ${l-isa3} $words
} {{l is a lstring} {2 7 10 16 25 29 36 39 47 55 58 63} {l is a lstring} {l is a lstring} {My name is Inigo Montoya. You killed my father. Prepare to die!}}
test abstractlist-2.4 {no shimmer foreach} {
set l [lstring $str]
set l-isa [value-isa l]
set word {}
set words {}
foreach c $l {
if {$c eq { }} {
lappend words $word
set word {}
} else {
append word $c
}
}
if {$word ne ""} {
lappend words $word
}
set l-isa2 [value-isa l]
list ${l-isa} ${l-isa2} $words
} {{l is a lstring} {l is a lstring} {My name is Inigo Montoya. You killed my father. Prepare to die!}}
#
# The TBCE implements lreplace as a lrange + lappend operation, so, in this case, $m results is a list, not an lstring.
#
test abstractlist-2.5 {!no shimmer lreplace} {
set l [lstring $str2]
set l-isa [value-isa l]
set m [lreplace $l 18 23 { } f a i l ?]
set m-isa [value-isa m]
set l-isa1 [value-isa l]
list ${l-isa} $m ${m-isa} ${l-isa1}
} {{l is a lstring} {V i z z i n i : { } H E { } D I D N ' T { } f a i l ? { } I N C O N C E I V A B L E . { } I n i g o { } M o n t o y a : { } Y o u { } k e e p { } u s i n g { } t h a t { } w o r d . { } I { } d o { } n o t { } t h i n k { } i t { } m e a n s { } w h a t { } y o u { } t h i n k { } i t { } m e a n s .} {m is a list} {l is a lstring}}
test abstractlist-2.6 {no shimmer ledit} {
# "ledit m 9 8 S"
set l [lstring $str2]
set l-isa [value-isa l]
set e [ledit l 9 8 S]
set e-isa [value-isa e]
list ${l-isa} $e ${e-isa}
} {{l is a lstring} {V i z z i n i : { } S H E { } D I D N ' T { } F A L L ? { } I N C O N C E I V A B L E . { } I n i g o { } M o n t o y a : { } Y o u { } k e e p { } u s i n g { } t h a t { } w o r d . { } I { } d o { } n o t { } t h i n k { } i t { } m e a n s { } w h a t { } y o u { } t h i n k { } i t { } m e a n s .} {e is a lstring}}
test abstractlist-2.7 {no shimmer linsert} {
# "ledit m 9 8 S"
set l [lstring $str2]
set l-isa [value-isa l]
set i [linsert $l 12 {*}[split "almost " {}]]
set i-isa [value-isa i]
set res [list ${l-isa} $i ${i-isa}]
set p [lpop i 23]
set p-isa [value-isa p]
set i-isa2 [value-isa i]
lappend res $p ${p-isa} $i ${i-isa2}
} {{l is a lstring} {V i z z i n i : { } H E { } a l m o s t { } D I D N ' T { } F A L L ? { } I N C O N C E I V A B L E . { } I n i g o { } M o n t o y a : { } Y o u { } k e e p { } u s i n g { } t h a t { } w o r d . { } I { } d o { } n o t { } t h i n k { } i t { } m e a n s { } w h a t { } y o u { } t h i n k { } i t { } m e a n s .} {i is a lstring} ' {p is a pure} {V i z z i n i : { } H E { } a l m o s t { } D I D N T { } F A L L ? { } I N C O N C E I V A B L E . { } I n i g o { } M o n t o y a : { } Y o u { } k e e p { } u s i n g { } t h a t { } w o r d . { } I { } d o { } n o t { } t h i n k { } i t { } m e a n s { } w h a t { } y o u { } t h i n k { } i t { } m e a n s .} {i is a lstring}}
test abstractlist-2.8 {shimmer lassign} {
set l [lstring Inconceivable]
set l-isa [value-isa l]
set l2 [lassign $l i n c]
set l-isa2 [value-isa l]
set l2-isa [value-isa l2]
list $l ${l-isa} $l2 ${l-isa2} ${l2-isa}
} {{I n c o n c e i v a b l e} {l is a lstring} {o n c e i v a b l e} {l is a lstring} {l2 is a lstring}}
test abstractlist-2.9 {no shimmer lremove} {
set l [lstring Inconceivable]
set l-isa [value-isa l]
set l2 [lremove $l 0 1]
set l-isa2 [value-isa l]
set l2-isa [value-isa l2]
list $l ${l-isa} $l2 ${l-isa2} ${l2-isa}
} {{I n c o n c e i v a b l e} {l is a lstring} {c o n c e i v a b l e} {l is a lstring} {l2 is a lstring}}
test abstractlist-2.10 {shimmer lreverse} {
set l [lstring Inconceivable]
set l-isa [value-isa l]
set l2 [lreverse $l]
set l-isa2 [value-isa l]
set l2-isa [value-isa l2]
list $l ${l-isa} $l2 ${l-isa2} ${l2-isa}
} {{I n c o n c e i v a b l e} {l is a lstring} {e l b a v i e c n o c n I} {l is a lstring} {l2 is a lstring}}
test abstractlist-2.11 {shimmer lset} {
set l [lstring Inconceivable]
set l-isa [value-isa l]
set m [lset l 2 k]
set m-isa [value-isa m]
list $l ${l-isa} $m ${m-isa} [value-cmp l m]
} {{I n k o n c e i v a b l e} {l is a lstring} {I n k o n c e i v a b l e} {m is a lstring} 0}
# lrepeat
test abstractlist-2.12 {shimmer lrepeat} {
set l [lstring Inconceivable]
set l-isa [value-isa l]
set m [lrepeat 3 $l]
set m-isa [value-isa m]
set n [lindex $m 1]
list $l ${l-isa} $m ${m-isa} [value-isa n] [value-cmp l n]
} {{I n c o n c e i v a b l e} {l is a lstring} {{I n c o n c e i v a b l e} {I n c o n c e i v a b l e} {I n c o n c e i v a b l e}} {m is a list} {n is a lstring} 0}
test abstractlist-2.13 {no shimmer join llength==1} {
set l [lstring G]
set l-isa [value-isa l]
set j [join $l :]
set j-isa [value-isa j]
list ${l-isa} $l ${j-isa} $j
} {{l is a lstring} G {j is a pure} G}
# lsort
test abstractlist-3.0 {no shimmer llength} {
set l [lstring -not SLICE $str]
set l-isa [value-isa l]
set len [llength $l]
set l-isa2 [value-isa l]
list $l ${l-isa} ${len} ${l-isa2}
} {{M y { } n a m e { } i s { } I n i g o { } M o n t o y a . { } Y o u { } k i l l e d { } m y { } f a t h e r . { } P r e p a r e { } t o { } d i e !} {l is a lstring} 63 {l is a lstring}}
test abstractlist-3.1 {no shimmer lindex} {
set l [lstring -not SLICE $str]
set l-isa [value-isa l]
set ele [lindex $l 22]
set l-isa2 [value-isa l]
list $l ${l-isa} ${ele} ${l-isa2}
} {{M y { } n a m e { } i s { } I n i g o { } M o n t o y a . { } Y o u { } k i l l e d { } m y { } f a t h e r . { } P r e p a r e { } t o { } d i e !} {l is a lstring} y {l is a lstring}}
test abstractlist-3.2 {no shimmer lreverse} {
set l [lstring -not SLICE $str]
set l-isa [value-isa l]
set r [lreverse $l]
set r-isa [value-isa r]
set l-isa2 [value-isa l]
list $r ${l-isa} ${r-isa} ${l-isa2}
} {{! e i d { } o t { } e r a p e r P { } . r e h t a f { } y m { } d e l l i k { } u o Y { } . a y o t n o M { } o g i n I { } s i { } e m a n { } y M} {l is a lstring} {r is a lstring} {l is a lstring}}
test abstractlist-3.3 {shimmer lrange} {
set l [lstring -not SLICE $str]
set l-isa [value-isa l]
set il [lsearch -all [lstring -not SLICE $str] { }]
set l-isa2 [value-isa l]
lappend il [llength $l]
set start 0
set words [lmap i $il {
set w [join [lrange $l $start $i-1] {} ]
set start [expr {$i+1}]
set w
}]
set l-isa3 [value-isa l]; # lrange defaults to list behavior
list ${l-isa} $il ${l-isa2} ${l-isa3} $words
} {{l is a lstring} {2 7 10 16 25 29 36 39 47 55 58 63} {l is a lstring} {l is a list} {My name is Inigo Montoya. You killed my father. Prepare to die!}}
test abstractlist-3.4 {no shimmer foreach} {
set l [lstring -not SLICE $str]
set l-isa [value-isa l]
set word {}
set words {}
foreach c $l {
if {$c eq { }} {
lappend words $word
set word {}
} else {
append word $c
}
}
if {$word ne ""} {
lappend words $word
}
set l-isa2 [value-isa l]
list ${l-isa} ${l-isa2} $words
} {{l is a lstring} {l is a lstring} {My name is Inigo Montoya. You killed my father. Prepare to die!}}
#
# The TBCE implements lreplace as a lrange + lappend operation, so, in this case, $m results is a list, not an lstring.
#
test abstractlist-3.5 {!no shimmer lreplace} {
set l [lstring -not SLICE $str2]
set l-isa [value-isa l]
set m [lreplace $l 18 23 { } f a i l ?]
set m-isa [value-isa m]
set l-isa1 [value-isa l]
list ${l-isa} $m ${m-isa} ${l-isa1}
} {{l is a lstring} {V i z z i n i : { } H E { } D I D N ' T { } f a i l ? { } I N C O N C E I V A B L E . { } I n i g o { } M o n t o y a : { } Y o u { } k e e p { } u s i n g { } t h a t { } w o r d . { } I { } d o { } n o t { } t h i n k { } i t { } m e a n s { } w h a t { } y o u { } t h i n k { } i t { } m e a n s .} {m is a list} {l is a lstring}}
test abstractlist-3.6 {no shimmer ledit} {
# "ledit m 9 8 S"
set l [lstring -not SLICE $str2]
set l-isa [value-isa l]
set e [ledit l 9 8 S]
set e-isa [value-isa e]
list ${l-isa} $e ${e-isa}
} {{l is a lstring} {V i z z i n i : { } S H E { } D I D N ' T { } F A L L ? { } I N C O N C E I V A B L E . { } I n i g o { } M o n t o y a : { } Y o u { } k e e p { } u s i n g { } t h a t { } w o r d . { } I { } d o { } n o t { } t h i n k { } i t { } m e a n s { } w h a t { } y o u { } t h i n k { } i t { } m e a n s .} {e is a lstring}}
test abstractlist-3.7 {no shimmer linsert} {
# "ledit m 9 8 S"
set res {}
set l [lstring -not SLICE $str2]
set l-isa [value-isa l]
set i [linsert $l 12 {*}[split "almost " {}]]
set i-isa [value-isa i]
set res [list ${l-isa} $i ${i-isa}]
set p [lpop i 23]
set p-isa [value-isa p]
set i-isa2 [value-isa i]
lappend res $p ${p-isa} $i ${i-isa2}
} {{l is a lstring} {V i z z i n i : { } H E { } a l m o s t { } D I D N ' T { } F A L L ? { } I N C O N C E I V A B L E . { } I n i g o { } M o n t o y a : { } Y o u { } k e e p { } u s i n g { } t h a t { } w o r d . { } I { } d o { } n o t { } t h i n k { } i t { } m e a n s { } w h a t { } y o u { } t h i n k { } i t { } m e a n s .} {i is a lstring} ' {p is a pure} {V i z z i n i : { } H E { } a l m o s t { } D I D N T { } F A L L ? { } I N C O N C E I V A B L E . { } I n i g o { } M o n t o y a : { } Y o u { } k e e p { } u s i n g { } t h a t { } w o r d . { } I { } d o { } n o t { } t h i n k { } i t { } m e a n s { } w h a t { } y o u { } t h i n k { } i t { } m e a n s .} {i is a lstring}}
test abstractlist-3.8 {shimmer lassign} {
set l [lstring -not SLICE Inconceivable]
set l-isa [value-isa l]
set l2 [lassign $l i n c] ;# must be using lrange internally
set l-isa2 [value-isa l]
set l2-isa [value-isa l2]
list $l ${l-isa} $l2 ${l-isa2} ${l2-isa}
} {{I n c o n c e i v a b l e} {l is a lstring} {o n c e i v a b l e} {l is a lstring} {l2 is a list}}
test abstractlist-3.9 {no shimmer lremove} {
set l [lstring -not SLICE Inconceivable]
set l-isa [value-isa l]
set l2 [lremove $l 0 1]
set l-isa2 [value-isa l]
set l2-isa [value-isa l2]
list $l ${l-isa} $l2 ${l-isa2} ${l2-isa}
} {{I n c o n c e i v a b l e} {l is a lstring} {c o n c e i v a b l e} {l is a lstring} {l2 is a lstring}}
test abstractlist-3.10 {shimmer lreverse} {
set l [lstring -not SLICE Inconceivable]
set l-isa [value-isa l]
set l2 [lreverse $l]
set l-isa2 [value-isa l]
set l2-isa [value-isa l2]
list $l ${l-isa} $l2 ${l-isa2} ${l2-isa}
} {{I n c o n c e i v a b l e} {l is a lstring} {e l b a v i e c n o c n I} {l is a lstring} {l2 is a lstring}}
test abstractlist-3.11 {shimmer lset} {
set l [lstring -not SLICE Inconceivable]
set l-isa [value-isa l]
set m [lset l 2 k]
set m-isa [value-isa m]
list $l ${l-isa} $m ${m-isa} [value-cmp l m]
} {{I n k o n c e i v a b l e} {l is a lstring} {I n k o n c e i v a b l e} {m is a lstring} 0}
# lrepeat
test abstractlist-3.12 {shimmer lrepeat} {
set l [lstring -not SLICE Inconceivable]
set l-isa [value-isa l]
set m [lrepeat 3 $l]
set m-isa [value-isa m]
set n [lindex $m 1]
list $l ${l-isa} $m ${m-isa} [value-isa n] [value-cmp l n]
} {{I n c o n c e i v a b l e} {l is a lstring} {{I n c o n c e i v a b l e} {I n c o n c e i v a b l e} {I n c o n c e i v a b l e}} {m is a list} {n is a lstring} 0}
# lsort
foreach not {{} REVERSE SLICE SETELEMENT REPLACE GETELEMENTS} {
testConstraint [format "%sShimmer" [string totitle $not]] [expr {$not eq ""}]
set options [expr {$not ne "" ? "-not $not" : ""}]
test abstractlist-$not-4.0 {no shimmer llength} {
set l [lstring {*}$options $str]
set l-isa [value-isa l]
set len [llength $l]
set l-isa2 [value-isa l]
list $l ${l-isa} ${len} ${l-isa2}
} {{M y { } n a m e { } i s { } I n i g o { } M o n t o y a . { } Y o u { } k i l l e d { } m y { } f a t h e r . { } P r e p a r e { } t o { } d i e !} {l is a lstring} 63 {l is a lstring}}
test abstractlist-$not-4.1 {no shimmer lindex} {
set l [lstring {*}$options $str]
set l-isa [value-isa l]
set ele [lindex $l 22]
set l-isa2 [value-isa l]
list $l ${l-isa} ${ele} ${l-isa2}
} {{M y { } n a m e { } i s { } I n i g o { } M o n t o y a . { } Y o u { } k i l l e d { } m y { } f a t h e r . { } P r e p a r e { } t o { } d i e !} {l is a lstring} y {l is a lstring}}
test abstractlist-$not-4.2 {lreverse} ReverseShimmer {
set l [lstring {*}$options $str]
set l-isa [value-isa l]
set r [lreverse $l]
set r-isa [value-isa r]
set l-isa2 [value-isa l]
list $r ${l-isa} ${r-isa} ${l-isa2}
} {{! e i d { } o t { } e r a p e r P { } . r e h t a f { } y m { } d e l l i k { } u o Y { } . a y o t n o M { } o g i n I { } s i { } e m a n { } y M} {l is a lstring} {r is a lstring} {l is a lstring}}
test abstractlist-$not-4.3 {no shimmer lrange} RangeShimmer {
set l [lstring {*}$options $str]
set l-isa [value-isa l]
set il [lsearch -all [lstring {*}$options $str] { }]
set l-isa2 [value-isa l]
lappend il [llength $l]
set start 0
set words [lmap i $il {
set w [join [lrange $l $start $i-1] {} ]
set start [expr {$i+1}]
set w
}]
set l-isa3 [value-isa l]
list ${l-isa} $il ${l-isa2} ${l-isa3} $words
} {{l is a lstring} {2 7 10 16 25 29 36 39 47 55 58 63} {l is a lstring} {l is a lstring} {My name is Inigo Montoya. You killed my father. Prepare to die!}}
test abstractlist-$not-4.4 {no shimmer foreach} {
set l [lstring {*}$options $str]
set l-isa [value-isa l]
set word {}
set words {}
foreach c $l {
if {$c eq { }} {
lappend words $word
set word {}
} else {
append word $c
}
}
if {$word ne ""} {
lappend words $word
}
set l-isa2 [value-isa l]
list ${l-isa} ${l-isa2} $words
} {{l is a lstring} {l is a lstring} {My name is Inigo Montoya. You killed my father. Prepare to die!}}
#
# The TBCE implements lreplace as a lrange + lappend operation, so, in this case, $m results is a list, not an lstring.
#
test abstractlist-$not-4.5 {!no shimmer lreplace} {
set l [lstring {*}$options $str2]
set l-isa [value-isa l]
set m [lreplace $l 18 23 { } f a i l ?]
set m-isa [value-isa m]
set l-isa1 [value-isa l]
list ${l-isa} $m ${m-isa} ${l-isa1}
} {{l is a lstring} {V i z z i n i : { } H E { } D I D N ' T { } f a i l ? { } I N C O N C E I V A B L E . { } I n i g o { } M o n t o y a : { } Y o u { } k e e p { } u s i n g { } t h a t { } w o r d . { } I { } d o { } n o t { } t h i n k { } i t { } m e a n s { } w h a t { } y o u { } t h i n k { } i t { } m e a n s .} {m is a list} {l is a lstring}}
test abstractlist-$not-4.6 {no shimmer ledit} {SetelementShimmer ReplaceShimmer} {
# "ledit m 9 8 S"
set l [lstring {*}$options $str2]
set l-isa [value-isa l]
set e [ledit l 9 8 S]
set e-isa [value-isa e]
list ${l-isa} $e ${e-isa}
} {{l is a lstring} {V i z z i n i : { } S H E { } D I D N ' T { } F A L L ? { } I N C O N C E I V A B L E . { } I n i g o { } M o n t o y a : { } Y o u { } k e e p { } u s i n g { } t h a t { } w o r d . { } I { } d o { } n o t { } t h i n k { } i t { } m e a n s { } w h a t { } y o u { } t h i n k { } i t { } m e a n s .} {e is a lstring}}
test abstractlist-$not-4.7 {no shimmer linsert} ReplaceShimmer {
# "ledit m 9 8 S"
set l [lstring {*}$options $str2]
set l-isa [value-isa l]
set i [linsert $l 12 {*}[split "almost " {}]]
set i-isa [value-isa i]
set res [list ${l-isa} $i ${i-isa}]
set p [lpop i 23]
set p-isa [value-isa p]
set i-isa2 [value-isa i]
lappend res $p ${p-isa} $i ${i-isa2}
} {{l is a lstring} {V i z z i n i : { } H E { } a l m o s t { } D I D N ' T { } F A L L ? { } I N C O N C E I V A B L E . { } I n i g o { } M o n t o y a : { } Y o u { } k e e p { } u s i n g { } t h a t { } w o r d . { } I { } d o { } n o t { } t h i n k { } i t { } m e a n s { } w h a t { } y o u { } t h i n k { } i t { } m e a n s .} {i is a lstring} ' {p is a pure} {V i z z i n i : { } H E { } a l m o s t { } D I D N T { } F A L L ? { } I N C O N C E I V A B L E . { } I n i g o { } M o n t o y a : { } Y o u { } k e e p { } u s i n g { } t h a t { } w o r d . { } I { } d o { } n o t { } t h i n k { } i t { } m e a n s { } w h a t { } y o u { } t h i n k { } i t { } m e a n s .} {i is a list}}
# lassign probably uses lrange internally
test abstractlist-$not-4.8 {shimmer lassign} RangeShimmer {
set l [lstring {*}$options Inconceivable]
set l-isa [value-isa l]
set l2 [lassign $l i n c]
set l-isa2 [value-isa l]
set l2-isa [value-isa l2]
list $l ${l-isa} $l2 ${l-isa2} ${l2-isa}
} {{I n c o n c e i v a b l e} {l is a lstring} {o n c e i v a b l e} {l is a lstring} {l2 is a lstring}}
test abstractlist-$not-4.9 {no shimmer lremove} ReplaceShimmer {
set l [lstring {*}$options Inconceivable]
set l-isa [value-isa l]
set l2 [lremove $l 0 1]
set l-isa2 [value-isa l]
set l2-isa [value-isa l2]
list $l ${l-isa} $l2 ${l-isa2} ${l2-isa}
} {{I n c o n c e i v a b l e} {l is a lstring} {c o n c e i v a b l e} {l is a lstring} {l2 is a lstring}}
test abstractlist-$not-4.10 {shimmer lreverse} ReverseShimmer {
set l [lstring {*}$options Inconceivable]
set l-isa [value-isa l]
set l2 [lreverse $l]
set l-isa2 [value-isa l]
set l2-isa [value-isa l2]
list $l ${l-isa} $l2 ${l-isa2} ${l2-isa}
} {{I n c o n c e i v a b l e} {l is a lstring} {e l b a v i e c n o c n I} {l is a lstring} {l2 is a lstring}}
test abstractlist-$not-4.11 {shimmer lset} SetelementShimmer {
set l [lstring {*}$options Inconceivable]
set l-isa [value-isa l]
set m [lset l 2 k]
set m-isa [value-isa m]
list $l ${l-isa} $m ${m-isa} [value-cmp l m]
} {{I n k o n c e i v a b l e} {l is a lstring} {I n k o n c e i v a b l e} {m is a lstring} 0}
# lrepeat
test abstractlist-$not-4.12 {shimmer lrepeat} {
set l [lstring {*}$options Inconceivable]
set l-isa [value-isa l]
set m [lrepeat 3 $l]
set m-isa [value-isa m]
set n [lindex $m 1]
list $l ${l-isa} $m ${m-isa} [value-isa n] [value-cmp l n]
} {{I n c o n c e i v a b l e} {l is a lstring} {{I n c o n c e i v a b l e} {I n c o n c e i v a b l e} {I n c o n c e i v a b l e}} {m is a list} {n is a lstring} 0}
memory tag {}
memory trace off
# Disable constraint
testConstraint [format "%sShimmer" [string totitle $not]] 1
}
# lsort
# cleanup
::tcltest::cleanupTests
proc my_abstl_cleanup {vars} {
set nowvars [uplevel info vars]
foreach var $nowvars {
if {$var ni $vars} {
uplevel unset $var
lappend clean-list $var
}
}
return ${clean-list}
}
my_abstl_cleanup $abstractlisttestvars
|
Changes to win/Makefile.in.
| ︙ | ︙ | |||
266 267 268 269 270 271 272 |
${AC_FLAGS} ${COMPILE_DEBUG_FLAGS}
TCLTEST_OBJS = \
tclTest.$(OBJEXT) \
tclTestObj.$(OBJEXT) \
tclTestProcBodyObj.$(OBJEXT) \
tclThreadTest.$(OBJEXT) \
| | > | 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 |
${AC_FLAGS} ${COMPILE_DEBUG_FLAGS}
TCLTEST_OBJS = \
tclTest.$(OBJEXT) \
tclTestObj.$(OBJEXT) \
tclTestProcBodyObj.$(OBJEXT) \
tclThreadTest.$(OBJEXT) \
tclWinTest.$(OBJEXT) \
tclTestABSList.$(OBJEXT)
GENERIC_OBJS = \
regcomp.$(OBJEXT) \
regexec.$(OBJEXT) \
regfree.$(OBJEXT) \
regerror.$(OBJEXT) \
tclAbstractList.$(OBJEXT) \
|
| ︙ | ︙ |