Tcl Source Code

Check-in [b163c4f423]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Test code to investigate command ensemble argument reference counts
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | amg-string-insert
Files: files | file ages | folders
SHA1: b163c4f4234a7cd2bfff9b28d17d6694aae83760
User & Date: andy 2017-08-16 15:14:36
References
2017-08-17
17:29
Backout [b163c4f423]: Command ensembles indeed do affect argument reference counts, see [3397978fff] check-in: b83433c23f user: andy tags: amg-string-insert
Context
2017-08-17
17:29
Backout [b163c4f423]: Command ensembles indeed do affect argument reference counts, see [3397978fff] check-in: b83433c23f user: andy tags: amg-string-insert
2017-08-16
15:14
Test code to investigate command ensemble argument reference counts check-in: b163c4f423 user: andy tags: amg-string-insert
15:14
Fix typo check-in: 9f7c7d5fb4 user: andy tags: amg-string-insert
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to generic/tclCmdMZ.c.

3411
3412
3413
3414
3415
3416
3417



3418
3419
3420
3421
3422
3423
3424
	{"trim",	StringTrimCmd,	TclCompileStringTrimCmd, NULL, NULL, 0},
	{"trimleft",	StringTrimLCmd,	TclCompileStringTrimLCmd, NULL, NULL, 0},
	{"trimright",	StringTrimRCmd,	TclCompileStringTrimRCmd, NULL, NULL, 0},
	{"wordend",	StringEndCmd,	TclCompileBasic2ArgCmd, NULL, NULL, 0},
	{"wordstart",	StringStartCmd,	TclCompileBasic2ArgCmd, NULL, NULL, 0},
	{NULL, NULL, NULL, NULL, NULL, 0}
    };




    return TclMakeEnsemble(interp, "string", stringImplMap);
}

/*
 *----------------------------------------------------------------------
 *







>
>
>







3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
	{"trim",	StringTrimCmd,	TclCompileStringTrimCmd, NULL, NULL, 0},
	{"trimleft",	StringTrimLCmd,	TclCompileStringTrimLCmd, NULL, NULL, 0},
	{"trimright",	StringTrimRCmd,	TclCompileStringTrimRCmd, NULL, NULL, 0},
	{"wordend",	StringEndCmd,	TclCompileBasic2ArgCmd, NULL, NULL, 0},
	{"wordstart",	StringStartCmd,	TclCompileBasic2ArgCmd, NULL, NULL, 0},
	{NULL, NULL, NULL, NULL, NULL, 0}
    };

    /* XXX Test if ensembles are interfering with argument reference counts */
    Tcl_CreateObjCommand(interp, "stringInsert", StringInsertCmd, NULL, NULL);

    return TclMakeEnsemble(interp, "string", stringImplMap);
}

/*
 *----------------------------------------------------------------------
 *

Changes to tests/string.test.

2070
2071
2072
2073
2074
2075
2076

2077
2078
2079
2080
2081
2082
2083
2084
test string-30.10 {string insert, negative index} -body {
    string insert 0123 -1 _
} -returnCodes 1 -result {string index out of range}
test string-30.11 {string insert, index beyond end} -body {
    string insert 0123 5 _
} -returnCodes 1 -result {string index out of range}
test string-30.12 {string insert, start of string, pure byte array} {

    string insert [binary format a* 0123] 0 [binary format a* _]
} _0123
test string-30.13 {string insert, middle of string, pure byte array} {
    string insert [binary format a* 0123] 2 [binary format a* _]
} 01_23
test string-30.14 {string insert, end of string, pure byte array} {
    string insert [binary format a* 0123] 4 [binary format a* _]
} 0123_







>
|







2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
test string-30.10 {string insert, negative index} -body {
    string insert 0123 -1 _
} -returnCodes 1 -result {string index out of range}
test string-30.11 {string insert, index beyond end} -body {
    string insert 0123 5 _
} -returnCodes 1 -result {string index out of range}
test string-30.12 {string insert, start of string, pure byte array} {
    # XXX Test if ensembles are interfering with argument reference counts
    stringInsert [binary format a* 0123] 0 [binary format a* _]
} _0123
test string-30.13 {string insert, middle of string, pure byte array} {
    string insert [binary format a* 0123] 2 [binary format a* _]
} 01_23
test string-30.14 {string insert, end of string, pure byte array} {
    string insert [binary format a* 0123] 4 [binary format a* _]
} 0123_