Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testscript: remove leading newline before results #177

Merged
merged 1 commit into from Aug 22, 2022

Conversation

bitfield
Copy link
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
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.

None yet

2 participants