Skip to content

testscript: remove leading newline before results#177

Merged
mvdan merged 1 commit intorogpeppe:masterfrom
bitfield:no_newline
Aug 22, 2022
Merged

testscript: remove leading newline before results#177
mvdan merged 1 commit intorogpeppe:masterfrom
bitfield:no_newline

Conversation

@bitfield
Copy link
Copy Markdown
Contributor

Unlike go test, the testscript command prints a blank line before either 'PASS' or 'FAIL' and its other output:

testscript test.txtar

PASS

This makes it awkward to use in a loop over many scripts, one at a time. For example:

for TS in *.txtar; do
    echo -n "${TS}... "
    testscript ${TS}
done

The desired output is:

    test1.txtar... PASS
    test2.txtar... PASS
    ...

But instead, with this leading newline, we see:

    test1.txtar...
    PASS
    test2.txtar...
    PASS
    ...

This commit removes the newline.

Copy link
Copy Markdown
Collaborator

@mvdan mvdan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I imagine the reason was to prevent joining PASS or FAIL with the previous line, i.e. without a newline separating them.

But we don't have any tests that break due to this change, and the only two that change do so in a very reasonable way, so... SGTM :)

@mvdan mvdan merged commit c16c0a2 into rogpeppe:master Aug 22, 2022
@bitfield bitfield deleted the no_newline branch August 22, 2022 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants