Tcl Source Code

Check-in [82918e7090]
Login

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

Overview
Comment:EVIL HACKs are bad. Unnecessary ones are intolerable. Bad tests cause trouble.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | core-8-6-branch
Files: files | file ages | folders
SHA1: 82918e70904e5ebe97c9ff4d750882070fc3c802
User & Date: dgp 2016-10-20 17:54:47
Context
2016-10-20
20:02
Repair recently opened memleak. check-in: 1b68794acf user: dgp tags: core-8-6-branch
17:54
EVIL HACKs are bad. Unnecessary ones are intolerable. Bad tests cause trouble. check-in: 82918e7090 user: dgp tags: core-8-6-branch
2016-10-14
19:28
[eb6b68c1a9] Simple fix for [string replace] error demonstrated by new test. check-in: f58d30ec32 user: dgp tags: core-8-6-branch
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to generic/tclCompCmds.c.

3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226

    if (i > 1) {
	/*
	 * Do the concatenation, which produces the result.
	 */

	TclEmitInstInt1(INST_STR_CONCAT1, i, envPtr);
    } else {
	/*
	 * EVIL HACK! Force there to be a string representation in the case
	 * where there's just a "%s" in the format; case covered by the test
	 * format-20.1 (and it is horrible...)
	 */

	TclEmitOpcode(INST_DUP, envPtr);
	PushStringLiteral(envPtr, "");
	TclEmitOpcode(INST_STR_EQ, envPtr);
	TclEmitOpcode(INST_POP, envPtr);
    }
    return TCL_OK;
}

/*
 *----------------------------------------------------------------------
 *







<
<
<
<
<
<
<
<
<
<
<







3202
3203
3204
3205
3206
3207
3208











3209
3210
3211
3212
3213
3214
3215

    if (i > 1) {
	/*
	 * Do the concatenation, which produces the result.
	 */

	TclEmitInstInt1(INST_STR_CONCAT1, i, envPtr);











    }
    return TCL_OK;
}

/*
 *----------------------------------------------------------------------
 *

Changes to tests/format.test.

560
561
562
563
564
565
566
567



568
569
570
571
572
573
574
575
576
    string length [format %340f 0]
} 340

# Note that this test may fail in future versions
test format-20.1 {Bug 2932421: plain %s caused intrep change of args} -body {
    set x [dict create a b c d]
    format %s $x
    # After this, obj in $x should be a dict with a non-NULL bytes field



    tcl::unsupported::representation $x
} -match glob -result {value is a dict with *, string representation "*"}

# cleanup
catch {unset a}
catch {unset b}
catch {unset c}
catch {unset d}
::tcltest::cleanupTests







|
>
>
>

|







560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
    string length [format %340f 0]
} 340

# Note that this test may fail in future versions
test format-20.1 {Bug 2932421: plain %s caused intrep change of args} -body {
    set x [dict create a b c d]
    format %s $x
    # After this, obj in $x should be a dict
    # We are testing to make sure it has not been shimmered to a
    # different intrep when that is not necessary.
    # Whether or not there is a string rep - we should not care!
    tcl::unsupported::representation $x
} -match glob -result {value is a dict *}

# cleanup
catch {unset a}
catch {unset b}
catch {unset c}
catch {unset d}
::tcltest::cleanupTests