Skip to content
Tcl Source Code Changes To tcl::test commands
Login

Changes To tcl::test commands

Initial version of "tcl::test commands"














































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































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
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
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
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
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
634
635
636
637
638
639
640
641
642
643
644
645
646
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
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
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
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
# Tcl Test Harness Commands Reference

*This document has been generated using Claude. There will be errors of omission and commission. Please fix as you run into them and add new commands here when you add them to the code.*

This document lists all Tcl commands implemented by the Tcl test harness, as
found in the source files
[`generic/tclTest.c`](https://core.tcl-lang.org/tcl/file?name=generic/tclTest.c),
[`generic/tclTestObj.c`](https://core.tcl-lang.org/tcl/file?name=generic/tclTestObj.c),
[`generic/tclTestProcBodyObj.c`](https://core.tcl-lang.org/tcl/file?name=generic/tclTestProcBodyObj.c),
and
[`generic/tclTestABSList.c`](https://core.tcl-lang.org/tcl/file?name=generic/tclTestABSList.c).

These commands are **not** part of the standard Tcl distribution. They are
loaded only by the test suite (via the `tcl::test` package / `tcltest`
extension) and are intended exclusively for testing Tcl's C interfaces.

---

## Summary Table

| Command | Source File | Description |
|---|---|---|
| [`gettimes`](#gettimes) | `tclTest.c` | Measures time taken by various low-level Tcl operations. |
| [`lstring`](#lstring) | `tclTestABSList.c` | Creates an abstract-list object whose elements are the individual characters of a string. |
| [`noop`](#noop) | `tclTest.c` | No-operation command; used to measure dispatch overhead. |
| [`tcl::procbodytest::check`](#tclprocbodytestcheck) | `tclTestProcBodyObj.c` | Verifies the `tcl::procbodytest` package version matches what was registered. |
| [`tcl::procbodytest::proc`](#tclprocbodytestproc) | `tclTestProcBodyObj.c` | Creates a procedure by copying a compiled body from an existing proc. |
| [`testapplylambda`](#testapplylambda) | `tclTest.c` | Directly exercises the C entry point of the `apply` command. |
| [`testappverifierpresent`](#testappverifierpresent) | `tclTest.c` | Returns whether the Windows Application Verifier is attached. *(Windows only)* |
| [`testasync`](#testasync) | `tclTest.c` | Tests async handler facilities (`Tcl_AsyncCreate`, `Tcl_AsyncMark`, etc.). |
| [`testbigdata`](#testbigdata) | `tclTestObj.c` | Tests list/string operations near the `Tcl_Size`/`INT_MAX` boundary. *(64-bit only)* |
| [`testbignumobj`](#testbignumobj) | `tclTestObj.c` | Tests the bignum (`mp_int`) Tcl object type. |
| [`testbooleanobj`](#testbooleanobj) | `tclTestObj.c` | Tests the boolean Tcl object type. |
| [`testbumpinterpepoch`](#testbumpinterpepoch) | `tclTest.c` | Increments the compile epoch to force bytecode recompilation. |
| [`testbytestring`](#testbytestring) | `tclTest.c` | Creates a byte-array object from a string without encoding conversion. |
| [`testchancreate`](#testchancreate) | `tclTest.c` | Creates an in-memory test channel. |
| [`testchannel`](#testchannel) | `tclTest.c` | Exercises the channel I/O management internals. |
| [`testchannelevent`](#testchannelevent) | `tclTest.c` | Installs a Tcl script as a channel event handler. |
| [`testcmdinfo`](#testcmdinfo) | `tclTest.c` | Tests `Tcl_GetCommandInfo` and `Tcl_SetCommandInfo`. |
| [`testcmdtrace`](#testcmdtrace) | `tclTest.c` | Tests `Tcl_CreateTrace` / `Tcl_DeleteTrace`. |
| [`testcmdtoken`](#testcmdtoken) | `tclTest.c` | Tests `Tcl_Command` tokens and name-lookup functions. |
| [`testconcatobj`](#testconcatobj) | `tclTest.c` | Tests `Tcl_ConcatObj` with a fixed set of objects. |
| [`testcpuid`](#testcpuid) | `tclTest.c` | Executes the `CPUID` instruction and returns register values. *(x86/non-macOS only)* |
| [`testcreatecommand`](#testcreatecommand) | `tclTest.c` | Tests namespace placement of commands created with `Tcl_CreateCommand`. |
| [`testdcall`](#testdcall) | `tclTest.c` | Tests `Tcl_CallWhenDeleted` / `Tcl_DontCallWhenDeleted`. |
| [`testdel`](#testdel) | `tclTest.c` | Tests command deletion callbacks via a cross-interpreter command. |
| [`testdelassocdata`](#testdelassocdata) | `tclTest.c` | Calls `Tcl_DeleteAssocData` to remove an association from the interpreter. |
| [`testdoubledigits`](#testdoubledigits) | `tclTest.c` | Directly exercises the `TclDoubleDigits` floating-point digit extractor. |
| [`testdoubleobj`](#testdoubleobj) | `tclTestObj.c` | Tests the double-precision floating-point Tcl object type. |
| [`testdstring`](#testdstring) | `tclTest.c` | Tests the `Tcl_DString` dynamic-string API. |
| [`testencoding`](#testencoding) | `tclTest.c` | Tests the encoding system, including direct calls to conversion functions. |
| [`testevalex`](#testevalex) | `tclTest.c` | Calls `Tcl_EvalEx` on a script, optionally in the global namespace. |
| [`testevalobjv`](#testevalobjv) | `tclTest.c` | Calls `Tcl_EvalObjv` with a list of word objects. |
| [`testevent`](#testevent) | `tclTest.c` | Tests the event queue (`Tcl_QueueEvent`, `Tcl_DeleteEvents`). |
| [`testexithandler`](#testexithandler) | `tclTest.c` | Tests `Tcl_CreateExitHandler` / `Tcl_DeleteExitHandler`. |
| [`testexitmainloop`](#testexitmainloop) | `tclTest.c` | Signals the test main loop installed by `testsetmainloop` to exit. |
| [`testexprdouble`](#testexprdouble) | `tclTest.c` | Calls `Tcl_ExprDouble` and appends the result without clearing the interpreter result. |
| [`testexprdoubleobj`](#testexprdoubleobj) | `tclTest.c` | Calls `Tcl_ExprDoubleObj` (object form) and appends the result. |
| [`testexprlong`](#testexprlong) | `tclTest.c` | Calls `Tcl_ExprLong` and appends the result without clearing the interpreter result. |
| [`testexprlongobj`](#testexprlongobj) | `tclTest.c` | Calls `Tcl_ExprLongObj` (object form) and appends the result. |
| [`testexprparser`](#testexprparser) | `tclTest.c` | Parses an expression with `Tcl_ParseExpr` and returns the parse tree. |
| [`testexprstring`](#testexprstring) | `tclTest.c` | Calls `Tcl_ExprString` on an expression. |
| [`testfevent`](#testfevent) | `tclTest.c` | Tests file-event handling by associating a script with a channel event. |
| [`testfile`](#testfile) | `tclTest.c` | Tests miscellaneous VFS operations (`stat`, `access`, `chdir`, etc.). |
| [`testfilelink`](#testfilelink) | `tclTest.c` | Tests `Tcl_FSLink` for reading and creating filesystem links. |
| [`testfilesystem`](#testfilesystem) | `tclTest.c` | Registers/unregisters a logging virtual filesystem. |
| [`testfindfirst`](#testfindfirst) | `tclTest.c` | Tests `Tcl_UtfFindFirst` to locate a character in a string. |
| [`testfindlast`](#testfindlast) | `tclTest.c` | Tests `Tcl_UtfFindLast` to locate the last occurrence of a character. |
| [`testfstildeexpand`](#testfstildeexpand) | `tclTest.c` | Tests tilde expansion in paths via `Tcl_FSTildeExpand`. |
| [`testgetassocdata`](#testgetassocdata) | `tclTest.c` | Calls `Tcl_GetAssocData` and returns the stored string. |
| [`testgetindexfromobjstruct`](#testgetindexfromobjstruct) | `tclTest.c` | Directly calls `Tcl_GetIndexFromObjStruct` for strided table lookup. |
| [`testgetint`](#testgetint) | `tclTest.c` | Tests `Tcl_GetInt` by converting a string to an integer. |
| [`testgetintforindex`](#testgetintforindex) | `tclTest.c` | Tests `Tcl_GetIntForIndex` for list-index expressions like `end-2`. |
| [`testgetplatform`](#testgetplatform) | `tclTest.c` | Returns the current platform string from `TclGetPlatform`. |
| [`testgetunichar`](#testgetunichar) | `tclTest.c` | Returns the Unicode code point at a byte position in a string. |
| [`testgetvarfullname`](#testgetvarfullname) | `tclTest.c` | Returns the fully-qualified name of a variable. |
| [`testhandlecount`](#testhandlecount) | `tclTest.c` | Returns the current Windows handle count for the process. *(Windows only)* |
| [`testhashsystemhash`](#testhashsystemhash) | `tclTest.c` | Tests the system hash function by hashing a string a given number of times. |
| [`testindexobj`](#testindexobj) | `tclTestObj.c` | Tests `Tcl_GetIndexFromObj` and keyword-table lookup. |
| [`testinterpdelete`](#testinterpdelete) | `tclTest.c` | Directly deletes a child interpreter by path. |
| [`testinterpresolver`](#testinterpresolver) | `tclTest.c` | Tests custom variable/namespace resolvers. |
| [`testintobj`](#testintobj) | `tclTestObj.c` | Tests the integer Tcl object type. |
| [`testisempty`](#testisempty) | `tclTestObj.c` | Tests the `TclIsEmpty` fast-path for empty-string detection. |
| [`testlink`](#testlink) | `tclTest.c` | Tests `Tcl_LinkVar` / `Tcl_UnlinkVar` for all supported C types. |
| [`testlinkarray`](#testlinkarray) | `tclTest.c` | Tests `Tcl_LinkArray` for typed C array linking. |
| [`testlistapi`](#testlistapi) | `tclTest.c` | Exercises list C API functions not easily reachable from script level. |
| [`testlistrep`](#testlistrep) | `tclTest.c` | Inspects and manipulates list internal representations. |
| [`testlistobj`](#testlistobj) | `tclTestObj.c` | Tests the list Tcl object type and associated C API. |
| [`testlocale`](#testlocale) | `tclTest.c` | Tests `setlocale` for different locale categories. |
| [`testlongsize`](#testlongsize) | `tclTest.c` | Returns the size of the C `long` type on the current platform. |
| [`testlutil`](#testlutil) | `tclTest.c` | Tests internal list utility functions. |
| [`testmainthread`](#testmainthread) | `tclTest.c` | Returns the Tcl thread ID of the main thread. |
| [`testmsb`](#testmsb) | `tclTest.c` | Returns the position of the most significant set bit via `TclMSB`. |
| [`testnrelevels`](#testnrelevels) | `tclTest.c` | Returns the current NRE and overall Tcl call stack depths. |
| [`testnreunwind`](#testnreunwind) | `tclTest.c` | Tests NRE call-stack unwinding. |
| [`testnumutfchars`](#testnumutfchars) | `tclTest.c` | Returns the number of UTF-8 characters in a string using `Tcl_NumUtfChars`. |
| [`testobj`](#testobj) | `tclTestObj.c` | Tests generic Tcl object operations (ref counting, type conversion, etc.). |
| [`testpanic`](#testpanic) | `tclTest.c` | Calls `Tcl_Panic`, causing immediate abnormal termination. |
| [`testparseargs`](#testparseargs) | `tclTest.c` | Tests `Tcl_ParseArgsObjv` with a fixed option table. |
| [`testparser`](#testparser) | `tclTest.c` | Calls `Tcl_ParseCommand` and returns the parse tree. |
| [`testparsevar`](#testparsevar) | `tclTest.c` | Tests `Tcl_ParseVar` on a variable reference string. |
| [`testparsevarname`](#testparsevarname) | `tclTest.c` | Tests `Tcl_ParseVarName` directly. |
| [`testpreferstable`](#testpreferstable) | `tclTest.c` | Returns whether the interpreter is configured for stable sorting. |
| [`testprint`](#testprint) | `tclTest.c` | Tests internal print/format utilities for floating-point values. |
| [`testpurebytesobj`](#testpurebytesobj) | `tclTest.c` | Creates a "pure bytes" Tcl object with no internal type. |
| [`testregexp`](#testregexp) | `tclTest.c` | Extended `regexp` variant that accepts internal low-level flags. |
| [`testreturn`](#testreturn) | `tclTest.c` | Tests `Tcl_Return` by constructing a return object with given options. |
| [`testservicemode`](#testservicemode) | `tclTest.c` | Gets or sets the interpreter's event-service mode flag. |
| [`testset2`](#testset2) | `tclTest.c` | Tests the two-part `Tcl_SetVar2` interface (array name + element name). |
| [`testsetassocdata`](#testsetassocdata) | `tclTest.c` | Calls `Tcl_SetAssocData` to store a string under a key. |
| [`testsetbytearraylength`](#testsetbytearraylength) | `tclTest.c` | Sets the internal length of a byte-array object without reallocating. |
| [`testseterr`](#testseterr) | `tclTest.c` | Calls `Tcl_SetVar` with `TCL_LEAVE_ERR_MSG`. |
| [`testseterrorcode`](#testseterrorcode) | `tclTest.c` | Tests `Tcl_SetErrorCode` by setting the error code to a list. |
| [`testsetmainloop`](#testsetmainloop) | `tclTest.c` | Installs a minimal C-level main loop via `Tcl_SetMainLoop`. |
| [`testsetnoerr`](#testsetnoerr) | `tclTest.c` | Calls `Tcl_SetVar` without `TCL_LEAVE_ERR_MSG`. |
| [`testsetobjerrorcode`](#testsetobjerrorcode) | `tclTest.c` | Tests `Tcl_SetObjErrorCode`. |
| [`testsetplatform`](#testsetplatform) | `tclTest.c` | Overrides the platform string returned by `TclGetPlatform`. |
| [`testsimplefilesystem`](#testsimplefilesystem) | `tclTest.c` | Registers/unregisters a minimal virtual filesystem. |
| [`testsize`](#testsize) | `tclTest.c` | Returns sizes of various Tcl internal types on the current platform. |
| [`testsocket`](#testsocket) | `tclTest.c` | Tests low-level socket creation via `Tcl_OpenTcpClient` / `Tcl_OpenTcpServer`. |
| [`teststaticlibrary`](#teststaticlibrary) | `tclTest.c` | Tests `Tcl_StaticLibrary` by registering and loading a dummy package. |
| [`teststringbytes`](#teststringbytes) | `tclTest.c` | Returns the raw byte representation of a string. |
| [`teststringobj`](#teststringobj) | `tclTestObj.c` | Tests the string Tcl object type. |
| [`testtranslatefilename`](#testtranslatefilename) | `tclTest.c` | Calls `Tcl_TranslateFileName` and returns the translated path. |
| [`testuniclass`](#testuniclass) | `tclTest.c` | Tests `Tcl_UniCharIs*` character-classification functions. |
| [`testupvar`](#testupvar) | `tclTest.c` | Tests `Tcl_UpVar` to link a variable across call levels. |
| [`testutfnext`](#testutfnext) | `tclTest.c` | Returns the byte offset of the next UTF-8 character using `TclUtfNext`. |
| [`testutfprev`](#testutfprev) | `tclTest.c` | Returns the byte offset of the previous UTF-8 character using `TclUtfPrev`. |
| [`testutftonormalized`](#testutftonormalized) | `tclTest.c` | Converts a string to Unicode NFC normalization form. |
| [`testutftonormalizeddstring`](#testutftonormalizeddstring) | `tclTest.c` | Like `testutftonormalized` but returns the result via a `Tcl_DString`. |
| [`testwrongnumargs`](#testwrongnumargs) | `tclTest.c` | Calls `Tcl_WrongNumArgs` and returns the resulting error message. |

---

## Command Reference

### `gettimes`
*Defined in `tclTest.c`*

Measures and reports the time taken by various low-level Tcl operations (object
creation, string manipulation, list operations, etc.). Takes no arguments. Used
for performance regression testing.

---

### `lstring`
*Defined in `tclTestABSList.c`*

**Syntax:** `lstring string ?typeVariant?`

Creates and returns an `lstring` abstract-list object whose elements are the
individual characters of *string*. Supports all standard list operations
(`llength`, `lindex`, `lrange`, `lreverse`, `lreplace`, `lset`) through the
abstract-list dispatch table without materialising a conventional Tcl list.

An optional integer *typeVariant* (0–10) selects one of 11 internal
`Tcl_ObjType` V2 table configurations in which individual function pointers
(`Length`, `Index`, `Slice`, `Reverse`, `GetElements`, `SetElement`, `Replace`)
are progressively omitted, exercising the abstract-list fallback paths when
individual operations are not provided.

---

### `noop`
*Defined in `tclTest.c`*

A no-operation command. Accepts any arguments and returns nothing. Used to
measure command dispatch overhead and as a placeholder in tests.

---

### `tcl::procbodytest::check`
*Defined in `tclTestProcBodyObj.c`*

**Syntax:** `tcl::procbodytest::check`

Verifies that `Tcl_PkgPresent` returns the same version string that was
registered when the `tcl::procbodytest` package was loaded. Returns a boolean
(`1` if they match, `0` otherwise).

---

### `tcl::procbodytest::proc`
*Defined in `tclTestProcBodyObj.c`*

**Syntax:** `tcl::procbodytest::proc newName argList bodyName`

Creates a new Tcl procedure *newName* with argument list *argList*, copying
the compiled body from the **existing** procedure *bodyName* as a `procbody`
object rather than recompiling a source string. Exercises the
`Tcl_ProcObjCmd` code path that accepts a pre-compiled procedure body.

```tcl
proc a {x} { return $x }
a 42                          ;# populate the compiled body
tcl::procbodytest::proc b {x} a
```

---

### `testapplylambda`
*Defined in `tclTest.c`*

**Syntax:** `testapplylambda lambda ?arg ...?`

Tests `Tcl_ApplyObjCmd` directly by applying *lambda* to the supplied
arguments, exercising the `apply` implementation's C entry point.

---

### `testappverifierpresent`
*Defined in `tclTest.c`* *(Windows only)*

Returns `1` if the Windows Application Verifier is attached to the current
process, `0` otherwise. Takes no arguments.

---

### `testasync`
*Defined in `tclTest.c`*

**Syntax:** `testasync option ?args?`

Tests the asynchronous handler facilities (`Tcl_AsyncCreate`, `Tcl_AsyncDelete`, `Tcl_AsyncMark`).

| Subcommand | Description |
|---|---|
| `create script` | Creates an async handler that evaluates *script* when triggered; returns an integer handler ID. |
| `delete ?id?` | Deletes the handler with the given *id*, or all handlers if no *id* is given. |
| `mark id result code` | Marks handler *id* as ready, sets the interpreter result to *result*, and returns *code*. |
| `marklater id` | Marks the handler from a newly spawned thread after a short delay. |

---

### `testbigdata`
*Defined in `tclTestObj.c`* *(64-bit platforms only)*

Tests list and string operations near the `Tcl_Size` / `INT_MAX` boundary by
constructing large objects. Available only when `sizeof(Tcl_Size) == sizeof(Tcl_WideInt)`.

---

### `testbignumobj`
*Defined in `tclTestObj.c`*

**Syntax:** `testbignumobj subcommand varIndex ?value?`

Tests the bignum (`mp_int`) Tcl object type using a pool of 20 shared object
variables (indexed 0–19).

| Subcommand | Description |
|---|---|
| `set varIndex value` | Parses *value* as a decimal bignum and stores it in variable *varIndex*. |
| `get varIndex` | Returns the bignum stored in *varIndex*. |
| `mult10 varIndex` | Multiplies the bignum in *varIndex* by 10 in place. |
| `div10 varIndex` | Divides the bignum in *varIndex* by 10 in place. |
| `iseven varIndex` | Replaces the bignum with a boolean indicating whether it is even. |
| `radixsize varIndex` | Replaces the bignum with the number of decimal digits required to represent it. |

---

### `testbooleanobj`
*Defined in `tclTestObj.c`*

**Syntax:** `testbooleanobj subcommand varIndex ?value?`

Tests the boolean Tcl object type using the shared object variable pool.

| Subcommand | Description |
|---|---|
| `set varIndex bool` | Stores the boolean *bool* in variable *varIndex*. |
| `get varIndex` | Returns the boolean stored in *varIndex*. |
| `not varIndex` | Logically negates the boolean in *varIndex*. |

---

### `testbumpinterpepoch`
*Defined in `tclTest.c`*

Increments the interpreter's compile epoch directly, forcing all cached
bytecodes to be recompiled on their next execution. Takes no arguments.

---

### `testbytestring`
*Defined in `tclTest.c`*

**Syntax:** `testbytestring string`

Creates a byte-array Tcl object from *string* without any encoding conversion.
Used to test pure byte-array handling paths that bypass the string-encoding
layer.

---

### `testchancreate`
*Defined in `tclTest.c`*

**Syntax:** `testchancreate mode name`

Creates a test channel with the given *mode* (`r`, `w`, or `rw`) and *name*,
backed by an in-memory buffer. Used to test the channel-creation API
(`Tcl_CreateChannel`) without requiring real I/O.

---

### `testchannel`
*Defined in `tclTest.c`*

**Syntax:** `testchannel subcommand ?arg ...?`

Exercises the channel I/O system. Subcommands include `cut`, `splice`, `info`,
`isstandard`, `readable`, `writable`, `inputbuffered`, `outputbuffered`,
`mode`, `name`, `open`, `close`, `refcount`, and `maxinputbuffered`. Used to
test channel management internals defined in `tclIO.h`.

---

### `testchannelevent`
*Defined in `tclTest.c`*

**Syntax:** `testchannelevent channel script ?flag?`

Installs a Tcl *script* as a channel event handler and exercises
`Tcl_CreateChannelHandler` / `Tcl_DeleteChannelHandler`.

---

### `testcmdinfo`
*Defined in `tclTest.c`*

**Syntax:** `testcmdinfo option commandName`

Tests `Tcl_GetCommandInfo` and `Tcl_SetCommandInfo`.

| Subcommand | Description |
|---|---|
| `create name` | Creates a test command named *name* with a known proc and delete proc. |
| `delete name` | Deletes the command and returns the deletion-callback string. |
| `get name` | Returns info about the command's proc, delete proc, namespace, and native-object proc status. |
| `modify name` | Replaces the command's implementation with a different proc/delete-proc pair. |

---

### `testcmdtrace`
*Defined in `tclTest.c`*

**Syntax:** `testcmdtrace option script`

Tests `Tcl_CreateTrace` / `Tcl_DeleteTrace`.

| Subcommand | Description |
|---|---|
| `tracetest script` | Installs a trace, evals *script*, and returns the accumulated trace log. |
| `deletetest script` | Installs a trace that removes itself on first invocation, then evals *script*. |
| `leveltest script` | Installs a trace limited to the current call depth plus 4 levels. |
| `resulttest script` | Installs an object-based trace that can return non-`TCL_OK` codes. |
| `doubletest script` | Installs two overlapping traces to test ordering. |

---

### `testcmdtoken`
*Defined in `tclTest.c`*

**Syntax:** `testcmdtoken option arg`

Tests `Tcl_Command` tokens and related functions (`Tcl_GetCommandName`,
`Tcl_GetCommandFullName`).

| Subcommand | Description |
|---|---|
| `create name` | Creates a command and returns its integer token ID. |
| `name id` | Returns the short and fully-qualified name of the command identified by *id*. |

---

### `testconcatobj`
*Defined in `tclTest.c`*

Tests `Tcl_ConcatObj` by concatenating a fixed set of test objects and
returning the result. Takes no arguments.

---

### `testcpuid`
*Defined in `tclTest.c`* *(x86 / non-macOS only)*

**Syntax:** `testcpuid index`

Executes the `CPUID` instruction with leaf *index* and returns a list of four
integer register values `{eax ebx ecx edx}`. Used to test the `TclWinCPUID`
helper function.

---

### `testcreatecommand`
*Defined in `tclTest.c`*

**Syntax:** `testcreatecommand option`

Tests that `Tcl_CreateCommand` places a new command in the correct namespace.
Also verifies that single colons in the middle or end of a command name are
not treated as namespace separators.

| Subcommand | Description |
|---|---|
| `create` | Creates the command `test_ns_basic::createdcommand`. |
| `delete` | Deletes `test_ns_basic::createdcommand`. |
| `create2` | Creates the command `value:at:`. |
| `delete2` | Deletes `value:at:`. |

---

### `testdcall`
*Defined in `tclTest.c`*

**Syntax:** `testdcall ?id ...?`

Tests `Tcl_CallWhenDeleted` / `Tcl_DontCallWhenDeleted`. Creates a child
interpreter, registers delete callbacks for each positive *id* (and
de-registers for negative *id*), deletes the interpreter, and returns the list
of callbacks that fired in the order they were called.

---

### `testdel`
*Defined in `tclTest.c`*

**Syntax:** `testdel interp name delcmdname`

Creates a command named *name* in the child interpreter *interp* that, when
deleted, evaluates *delcmdname* in the parent interpreter. Used to test command
deletion callbacks across interpreter boundaries.

---

### `testdelassocdata`
*Defined in `tclTest.c`*

**Syntax:** `testdelassocdata key`

Calls `Tcl_DeleteAssocData` to remove the key-value association for *key*
from the current interpreter.

---

### `testdoubledigits`
*Defined in `tclTest.c`*

**Syntax:** `testdoubledigits fpval ndigits type ?shorten?`

Directly exercises `TclDoubleDigits`, the low-level floating-point
digit-extraction primitive. *type* is one of `shortest`, `e`, or `f`. The
optional `shorten` flag enables the shortest-representation mode. Returns a
three-element list `{digits decpt sign}`.

---

### `testdoubleobj`
*Defined in `tclTestObj.c`*

**Syntax:** `testdoubleobj subcommand varIndex ?value?`

Tests the double-precision floating-point Tcl object type using the shared
object variable pool.

| Subcommand | Description |
|---|---|
| `set varIndex double` | Stores *double* in variable *varIndex*. |
| `get varIndex` | Returns the double stored in *varIndex*. |
| `mult10 varIndex` | Multiplies the double in *varIndex* by 10.0 in place. |
| `div10 varIndex` | Divides the double in *varIndex* by 10.0 in place. |

---

### `testdstring`
*Defined in `tclTest.c`*

**Syntax:** `testdstring option ?args?`

Tests the `Tcl_DString` dynamic-string API using a single global `Tcl_DString`.

| Subcommand | Description |
|---|---|
| `append string count` | Appends *count* bytes of *string* to the dynamic string. |
| `element string` | Appends *string* as a properly quoted list element. |
| `end` | Ends the current sublist. |
| `free` | Frees and re-initialises the dynamic string. |
| `get` | Returns the current dynamic string value. |
| `gresult type` | Sets the interpreter result to one of `staticsmall`, `staticlarge`, `free`, or `special`, then retrieves it into the dynamic string via `Tcl_DStringGetResult`. |
| `length` | Returns the current length of the dynamic string in bytes. |
| `result` | Moves the dynamic string value to the interpreter result. |
| `toobj` | Converts the dynamic string to a Tcl object via `Tcl_DStringToObj`. |
| `trunc length` | Truncates the dynamic string to *length* bytes. |
| `start` | Starts a new sublist. |

---

### `testencoding`
*Defined in `tclTest.c`*

**Syntax:** `testencoding option ?args?`

Tests the encoding subsystem.

| Subcommand | Description |
|---|---|
| `create name toutfcmd fromutfcmd` | Registers a new encoding that delegates conversion to Tcl scripts. |
| `delete name` | Frees a previously registered test encoding. |
| `nullength ?encoding?` | Returns the NUL-terminator byte size for the given encoding. |
| `Tcl_ExternalToUtf encoding src flags state dstlen ...` | Directly calls `Tcl_ExternalToUtf`. |
| `Tcl_UtfToExternal encoding src flags state dstlen ...` | Directly calls `Tcl_UtfToExternal`. |
| `Tcl_ExternalToUtfEx ...` | Calls the extended `Tcl_ExternalToUtfEx` variant. |
| `Tcl_UtfToExternalEx ...` | Calls the extended `Tcl_UtfToExternalEx` variant. |
| `Tcl_GetEncodingNameFromEnvironment` | Returns the encoding name obtained from the environment. |
| `Tcl_GetEncodingNameForUser` | Returns the user-preferred encoding name. |

---

### `testevalex`
*Defined in `tclTest.c`*

**Syntax:** `testevalex script ?global?`

Calls `Tcl_EvalEx` on *script*. If the optional argument `global` is supplied,
evaluates in the global namespace (`TCL_EVAL_GLOBAL`).

---

### `testevalobjv`
*Defined in `tclTest.c`*

**Syntax:** `testevalobjv global word ?word ...?`

Calls `Tcl_EvalObjv` with the given words. If *global* is true (`1`), evaluates
in the global namespace.

---

### `testevent`
*Defined in `tclTest.c`*

**Syntax:** `testevent subcommand ?args?`

Tests the event queue management functions `Tcl_QueueEvent` and
`Tcl_DeleteEvents`.

| Subcommand | Description |
|---|---|
| `queue name position script` | Queues an event tagged *name* at *position* (`head`, `tail`, or `mark`) that evaluates *script* when processed. |
| `delete name` | Removes all queued events tagged *name* from the event queue. |

---

### `testexithandler`
*Defined in `tclTest.c`*

**Syntax:** `testexithandler create|delete value`

Tests `Tcl_CreateExitHandler` / `Tcl_DeleteExitHandler`. Creates or deletes an
exit handler identified by the integer *value*. Odd values use one callback
function; even values use another.

---

### `testexitmainloop`
*Defined in `tclTest.c`*

Sets the flag that causes the test main loop installed by `testsetmainloop` to
exit. Takes no arguments.

---

### `testexprdouble`
*Defined in `tclTest.c`*

**Syntax:** `testexprdouble expression`

Calls `Tcl_ExprDouble` on *expression* and appends the floating-point result
to the current interpreter result, verifying that a successful evaluation does
not clear the existing result.

---

### `testexprdoubleobj`
*Defined in `tclTest.c`*

**Syntax:** `testexprdoubleobj expression`

Calls `Tcl_ExprDoubleObj` on *expression* passed as a Tcl object, and appends
the result to the current interpreter result.

---

### `testexprlong`
*Defined in `tclTest.c`*

**Syntax:** `testexprlong expression`

Calls `Tcl_ExprLong` on *expression* and appends the integer result to the
current interpreter result, verifying that a successful evaluation does not
clear the existing result.

---

### `testexprlongobj`
*Defined in `tclTest.c`*

**Syntax:** `testexprlongobj expression`

Calls `Tcl_ExprLongObj` on *expression* passed as a Tcl object, and appends
the result to the current interpreter result.

---

### `testexprparser`
*Defined in `tclTest.c`*

**Syntax:** `testexprparser expr length`

Parses *expr* as a Tcl expression using `Tcl_ParseExpr` (treating *length*
bytes, or the full string if *length* is 0) and returns a structured
description of the resulting parse tree.

---

### `testexprstring`
*Defined in `tclTest.c`*

**Syntax:** `testexprstring expression`

Calls `Tcl_ExprString` on *expression* and returns the result.

---

### `testfevent`
*Defined in `tclTest.c`*

**Syntax:** `testfevent channel script`

Tests file-event handling by associating a Tcl *script* with a channel's
readable or writable event.

---

### `testfile`
*Defined in `tclTest.c`*

**Syntax:** `testfile option ?args?`

Tests miscellaneous filesystem operations (`stat`, `access`, `chdir`,
`getcwd`) through the VFS layer.

---

### `testfilelink`
*Defined in `tclTest.c`*

**Syntax:** `testfilelink source ?target?`

Tests `Tcl_FSLink`. With one argument, reads the target of a symbolic link.
With two arguments, creates a link from *source* to *target*
(tries both symbolic and hard link types).

---

### `testfilesystem`
*Defined in `tclTest.c`*

**Syntax:** `testfilesystem mount|unmount`

Registers or unregisters a "reporting" virtual filesystem that logs every
filesystem operation it intercepts. Used to test `Tcl_FSRegister` /
`Tcl_FSUnregister` and to verify that VFS callbacks are invoked correctly.

---

### `testfindfirst`
*Defined in `tclTest.c`*

**Syntax:** `testfindfirst string char`

Tests `Tcl_UtfFindFirst` by searching *string* for the first occurrence of the
Unicode character *char* and returning the byte offset.

---

### `testfindlast`
*Defined in `tclTest.c`*

**Syntax:** `testfindlast string char`

Tests `Tcl_UtfFindLast` by searching *string* for the last occurrence of the
Unicode character *char* and returning the byte offset.

---

### `testfstildeexpand`
*Defined in `tclTest.c`*

**Syntax:** `testfstildeexpand path`

Tests tilde expansion in paths using `Tcl_FSTildeExpand` and returns the
expanded path.

---

### `testgetassocdata`
*Defined in `tclTest.c`*

**Syntax:** `testgetassocdata key`

Calls `Tcl_GetAssocData` and returns the string stored under *key* in the
current interpreter's association table.

---

### `testgetindexfromobjstruct`
*Defined in `tclTest.c`*

**Syntax:** `testgetindexfromobjstruct objPtr tablePtr offset`

Directly calls `Tcl_GetIndexFromObjStruct` to look up *objPtr* in a table
whose entries are *offset* bytes apart. Used to test strided keyword-table
lookup.

---

### `testgetint`
*Defined in `tclTest.c`*

**Syntax:** `testgetint string`

Tests `Tcl_GetInt` by converting *string* to an integer and returning it.

---

### `testgetintforindex`
*Defined in `tclTest.c`*

**Syntax:** `testgetintforindex string end`

Tests `Tcl_GetIntForIndex` by converting the list-index expression *string*
(which may use forms like `end`, `end-2`, or `3`) into an absolute integer
relative to the list length *end*.

---

### `testgetplatform`
*Defined in `tclTest.c`*

Returns the current platform string (`unix`, `mac`, or `windows`) as reported
by the internal `TclGetPlatform` function. Takes no arguments.

---

### `testgetunichar`
*Defined in `tclTest.c`*

**Syntax:** `testgetunichar string index`

Returns the Unicode code point at byte position *index* in *string* using the
internal UTF navigation functions.

---

### `testgetvarfullname`
*Defined in `tclTest.c`*

**Syntax:** `testgetvarfullname varname namespace`

Returns the fully-qualified name of a variable, exercising
`Tcl_FindNamespaceVar` and `Tcl_GetVariableFullName`.

---

### `testhandlecount`
*Defined in `tclTest.c`* *(Windows only)*

Returns the current Windows handle count for the process, used to detect
handle leaks in tests. Takes no arguments.

---

### `testhashsystemhash`
*Defined in `tclTest.c`*

**Syntax:** `testhashsystemhash string count`

Tests the system hash function by hashing *string* the given number of times
and returning the final hash value.

---

### `testindexobj`
*Defined in `tclTestObj.c`*

**Syntax:** `testindexobj subcommand ?args?`

Tests `Tcl_GetIndexFromObj` and related keyword-table lookup functions,
including the cached vs. non-cached code paths and error reporting.

| Subcommand | Description |
|---|---|
| `set varIndex tableIndex` | Looks up a keyword by index and stores the result. |
| `get varIndex` | Returns the keyword object stored in *varIndex*. |
| `get2 varIndex` | Exercises an alternative lookup path. |
| `formatwithmax ...` | Tests keyword lookup with a maximum-length bound. |
| `nosuchindex` | Tests error reporting when an index is out of range. |

---

### `testinterpdelete`
*Defined in `tclTest.c`*

**Syntax:** `testinterpdelete path`

Looks up the child interpreter at *path* relative to the current interpreter
and deletes it directly using `Tcl_DeleteInterp`. Used to test interpreter
deletion callbacks.

---

### `testinterpresolver`
*Defined in `tclTest.c`*

**Syntax:** `testinterpresolver option`

Tests custom variable and namespace resolvers installed via
`Tcl_AddInterpResolvers`. Subcommands: `install`, `remove`, `query`.

---

### `testintobj`
*Defined in `tclTestObj.c`*

**Syntax:** `testintobj subcommand varIndex ?value?`

Tests the integer and wide-integer Tcl object types using the shared object
variable pool. Subcommands: `set`, `get`, `mult10`, `div10`, `set2`
(uses `Tcl_SetIntObj` instead of `Tcl_NewIntObj`), `testseterror`.

---

### `testisempty`
*Defined in `tclTestObj.c`*

**Syntax:** `testisempty obj`

Returns `1` if *obj* is the empty string using the internal `TclIsEmpty`
fast-path check, `0` otherwise.

---

### `testlink`
*Defined in `tclTest.c`*

**Syntax:** `testlink option ?args?`

Tests `Tcl_LinkVar`, `Tcl_UnlinkVar`, and `Tcl_UpdateLinkedVar` for all
supported C types: `int`, `double`, `bool`, `string`, `wide`, `char`, `uchar`,
`short`, `ushort`, `uint`, `long`, `ulong`, `float`, and `uwide`.

| Subcommand | Description |
|---|---|
| `create boolFlags...` | Links each of the 14 typed C variables to a Tcl variable, using per-type boolean flags to set read-only status. |
| `delete` | Unlinks all previously linked variables. |
| `get` | Returns the current C-side values of all linked variables as a list. |
| `set values...` | Sets the C-side values directly, bypassing any Tcl write trace. |
| `update values...` | Sets the C-side values and calls `Tcl_UpdateLinkedVar` to propagate them to Tcl. |

---

### `testlinkarray`
*Defined in `tclTest.c`*

**Syntax:** `testlinkarray option ?args?`

Tests `Tcl_LinkArray` for array-linking of typed C data.

| Subcommand | Description |
|---|---|
| `create ?-readonly? type size name ?address?` | Links a Tcl variable to a C array of *size* elements of the given *type*. |
| `remove name ?name ...?` | Unlinks the named array variables. |
| `update name ?name ...?` | Pushes C-side array values back to their linked Tcl variables. |

---

### `testlistapi`
*Defined in `tclTest.c`*

**Syntax:** `testlistapi subcommand refcount list ?args?`

Exercises list C API functions not easily reached from script level, including
`Tcl_ListObjRange`, `Tcl_ListObjReverse`, and `Tcl_ListObjRepeat`. The
*refcount* argument controls how many extra references are held on the input
list to test shared-object handling. Returns a dictionary of input/output
object addresses, reference counts, type names, and results.

---

### `testlistrep`
*Defined in `tclTest.c`*

**Syntax:** `testlistrep subcommand ?args?`

Inspects and manipulates list internal representations directly.

| Subcommand | Description |
|---|---|
| `new length ?leadSpace endSpace?` | Creates a list object with a specific store layout including optional leading and trailing spare slots. |
| `describe object` | Returns a structured description of the list's store and optional span pointers, including memory addresses and field values. |
| `config` | Returns compile-time list configuration constants such as `LIST_SPAN_THRESHOLD`. |
| `validate object` | Panics if the list's internal representation is inconsistent; returns empty string on success. |

---

### `testlistobj`
*Defined in `tclTestObj.c`*

**Syntax:** `testlistobj subcommand varIndex ?args?`

Tests the list Tcl object type and the associated C API
(`Tcl_NewListObj`, `Tcl_ListObjAppendElement`, `Tcl_ListObjReplace`,
`Tcl_ListObjGetElements`, etc.) using the shared object variable pool.
Subcommands: `set`, `get`, `get2`, `replace`, `indexobj`, `setobj`.

---

### `testlocale`
*Defined in `tclTest.c`*

**Syntax:** `testlocale category ?locale?`

Tests `setlocale` by setting or querying the C locale for the given *category*
(`ctype`, `numeric`, `time`, `collate`, `monetary`, `all`). Returns the
current locale string.

---

### `testlongsize`
*Defined in `tclTest.c`*

Returns the size in bytes of the C `long` type on the current platform. Takes
no arguments.

---

### `testlutil`
*Defined in `tclTest.c`*

**Syntax:** `testlutil subcommand ?args?`

Tests internal list utility functions used in the implementation of commands
such as `lmap` and `lassign`.

---

### `testmainthread`
*Defined in `tclTest.c`*

Returns the Tcl thread ID of the main thread as recorded at initialization
time by `Tcl_GetCurrentThread`. Takes no arguments.

---

### `testmsb`
*Defined in `tclTest.c`*

**Syntax:** `testmsb integer`

Returns the zero-based position of the most significant set bit in the positive
*integer*, exercising the internal `TclMSB` utility macro/function.

---

### `testnrelevels`
*Defined in `tclTest.c`*

Returns a description of the current NRE (non-recursive evaluation) call stack
depth and the overall Tcl call depth, used to verify that NRE level accounting
is correct. Takes no arguments.

---

### `testnreunwind`
*Defined in `tclTest.c`*

Tests NRE call-stack unwinding by scheduling a post-processing callback via
`Tcl_NRAddCallback` that verifies the NRE stack is correctly cleaned up after
evaluation. Takes no arguments.

---

### `testnumutfchars`
*Defined in `tclTest.c`*

**Syntax:** `testnumutfchars string ?length?`

Returns the number of UTF-8 characters in *string* up to *length* bytes
(or the full string if *length* is omitted) using `Tcl_NumUtfChars`.

---

### `testobj`
*Defined in `tclTestObj.c`*

**Syntax:** `testobj subcommand ?args?`

Tests generic Tcl object operations using the shared variable pool. Subcommands:
`assign`, `convert`, `copy`, `decrefcount`, `deleteobj`, `freeallvars`,
`increfcount`, `ispresent`, `newobj`, `objtype`, `refcount`, `setintobj`,
`setvar`.

---

### `testpanic`
*Defined in `tclTest.c`*

**Syntax:** `testpanic message`

Calls `Tcl_Panic` with *message*, causing an immediate abnormal termination.
Used to test panic handling and to verify that a custom panic handler is invoked.

---

### `testparseargs`
*Defined in `tclTest.c`*

**Syntax:** `testparseargs ?options?`

Tests `Tcl_ParseArgsObjv` with a fixed option table, verifying correct option
parsing, default-value assignment, and error reporting for unrecognised options.

---

### `testparser`
*Defined in `tclTest.c`*

**Syntax:** `testparser script length`

Calls `Tcl_ParseCommand` on *script* (treating *length* bytes, or the full
string if *length* is 0) and returns a structured description of the resulting
parse tree, including token types, positions, and word counts.

---

### `testparsevar`
*Defined in `tclTest.c`*

**Syntax:** `testparsevar string`

Tests `Tcl_ParseVar` by parsing *string* as a Tcl variable reference and
returning the parsed structure.

---

### `testparsevarname`
*Defined in `tclTest.c`*

**Syntax:** `testparsevarname string length simple`

Tests `Tcl_ParseVarName` directly, returning parse-tree information for the
variable name found in *string*.

---

### `testpreferstable`
*Defined in `tclTest.c`*

Returns `1` if the interpreter is currently configured to prefer stable
(order-preserving) sorting, `0` otherwise. Takes no arguments.

---

### `testprint`
*Defined in `tclTest.c`*

**Syntax:** `testprint format value`

Tests internal print and format utility functions by formatting the
floating-point *value* with the given *format* string and returning the result.

---

### `testpurebytesobj`
*Defined in `tclTest.c`*

Creates a "pure bytes" Tcl object — an object with only a string representation
and no internal type pointer — used to test code paths that check for the
absence of an internal type. Takes no arguments.

---

### `testregexp`
*Defined in `tclTest.c`*

**Syntax:** `testregexp ?flags? pattern string`

An extended variant of `regexp` that accepts additional internal flags (prefixed
with `--`) to exercise low-level regular-expression code paths not reachable
through the standard `regexp` command.

---

### `testreturn`
*Defined in `tclTest.c`*

**Syntax:** `testreturn ?option value ...?`

Tests `Tcl_Return` by constructing and returning a return object with the
specified options (`-code`, `-errorinfo`, `-errorcode`, `-level`, etc.).

---

### `testservicemode`
*Defined in `tclTest.c`*

**Syntax:** `testservicemode ?mode?`

Gets or sets the interpreter's event-service mode flag, which controls whether
`Tcl_ServiceAll` processes events. Used to test event-loop behaviour.

---

### `testset2`
*Defined in `tclTest.c`*

**Syntax:** `testset2 varname ?value?`

Tests the two-part `Tcl_SetVar2` interface by splitting *varname* into an array
name and an element name.

---

### `testsetassocdata`
*Defined in `tclTest.c`*

**Syntax:** `testsetassocdata key value`

Stores *value* (as a string) under *key* in the current interpreter's
association table using `Tcl_SetAssocData`.

---

### `testsetbytearraylength`
*Defined in `tclTest.c`*

**Syntax:** `testsetbytearraylength obj length`

Sets the internal length of the byte-array object *obj* to *length* without
changing its allocated storage, used to test byte-array edge cases.

---

### `testseterr`
*Defined in `tclTest.c`*

**Syntax:** `testseterr varname ?value?`

Calls `Tcl_SetVar` with the `TCL_LEAVE_ERR_MSG` flag, so errors are reported
in the interpreter result.

---

### `testseterrorcode`
*Defined in `tclTest.c`*

**Syntax:** `testseterrorcode ?element ...?`

Tests `Tcl_SetErrorCode` by setting the interpreter's error code to the list
formed from the supplied *element* arguments.

---

### `testsetmainloop`
*Defined in `tclTest.c`*

Installs a minimal C-level main loop via `Tcl_SetMainLoop` that runs until
`testexitmainloop` is called. Takes no arguments.

---

### `testsetnoerr`
*Defined in `tclTest.c`*

**Syntax:** `testsetnoerr varname ?value?`

Calls `Tcl_SetVar` without `TCL_LEAVE_ERR_MSG`, so errors are silently
ignored. Returns the variable value.

---

### `testsetobjerrorcode`
*Defined in `tclTest.c`*

**Syntax:** `testsetobjerrorcode obj`

Tests `Tcl_SetObjErrorCode` by setting the interpreter's error code to the
given Tcl object.

---

### `testsetplatform`
*Defined in `tclTest.c`*

**Syntax:** `testsetplatform platform`

Overrides the platform string returned by `TclGetPlatform` to *platform*
(`unix`, `mac`, or `windows`), used to exercise platform-specific code paths
on any host operating system.

---

### `testsimplefilesystem`
*Defined in `tclTest.c`*

**Syntax:** `testsimplefilesystem mount|unmount`

Registers or unregisters a minimal "simple" virtual filesystem that implements
only the most basic operations. Used to test the abstract filesystem layer with
a reduced-functionality implementation.

---

### `testsize`
*Defined in `tclTest.c`*

Returns a dictionary containing the sizes (in bytes) of various Tcl internal
types (`Tcl_Obj`, `Tcl_Interp`, etc.) on the current platform. Takes no
arguments.

---

### `testsocket`
*Defined in `tclTest.c`*

**Syntax:** `testsocket ?options?`

Tests low-level socket creation via `Tcl_OpenTcpClient` and
`Tcl_OpenTcpServer`, verifying socket option flags and error paths.

---

### `teststaticlibrary`
*Defined in `tclTest.c`*

Tests `Tcl_StaticLibrary` (formerly `Tcl_StaticPackage`) by registering a
dummy static package and then loading it into the interpreter. Takes no
arguments.

---

### `teststringbytes`
*Defined in `tclTest.c`*

**Syntax:** `teststringbytes string`

Returns the raw byte representation of *string* without performing any Unicode
processing. Used to inspect low-level string storage.

---

### `teststringobj`
*Defined in `tclTestObj.c`*

**Syntax:** `teststringobj subcommand varIndex ?args?`

Tests the string Tcl object type using the shared variable pool. Subcommands:
`set`, `set2` (via `Tcl_SetStringObj`), `get`, `append`, `appendstrings`,
`getlength`, `getunicode`, `appendself`, `appendself2`.

---

### `testtranslatefilename`
*Defined in `tclTest.c`*

**Syntax:** `testtranslatefilename name`

Calls `Tcl_TranslateFileName` on *name* and returns the translated path.

---

### `testuniclass`
*Defined in `tclTest.c`*

**Syntax:** `testuniclass char class`

Tests `Tcl_UniCharIs*` character-classification functions. Returns `1` if the
Unicode character *char* belongs to *class* (e.g., `alpha`, `digit`, `space`,
`upper`, `lower`), `0` otherwise.

---

### `testupvar`
*Defined in `tclTest.c`*

**Syntax:** `testupvar level srcVar destVar`

Tests `Tcl_UpVar` by linking the variable *destVar* in the current scope to
*srcVar* at call level *level*.

---

### `testutfnext`
*Defined in `tclTest.c`*

**Syntax:** `testutfnext string`

Returns the byte offset of the start of the next UTF-8 character after position
0 in *string*, using the internal `TclUtfNext` function.

---

### `testutfprev`
*Defined in `tclTest.c`*

**Syntax:** `testutfprev string ?index?`

Returns the byte offset of the start of the UTF-8 character immediately before
*index* (or before the end of *string* if *index* is omitted), using `TclUtfPrev`.

---

### `testutftonormalized`
*Defined in `tclTest.c`*

**Syntax:** `testutftonormalized string`

Converts *string* to Unicode NFC (Canonical Decomposition followed by Canonical
Composition) normalization form using the internal UTF normalization routines
and returns the result.

---

### `testutftonormalizeddstring`
*Defined in `tclTest.c`*

**Syntax:** `testutftonormalizeddstring string`

Like `testutftonormalized` but accumulates the result via a `Tcl_DString`
rather than directly constructing a Tcl object.

---

### `testwrongnumargs`
*Defined in `tclTest.c`*

**Syntax:** `testwrongnumargs level message ?arg ...?`

Calls `Tcl_WrongNumArgs` with the supplied arguments and returns the resulting
error message. Used to test the wrong-argument-count error reporting API.

---

*All commands in this document are for **testing purposes only** and are not
part of the public Tcl API.*