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

testing: align -v output #10594

Closed
mdwhatcott opened this issue Apr 28, 2015 · 7 comments

Comments

Projects
None yet
5 participants
@mdwhatcott
Copy link

commented Apr 28, 2015

The go test output might be easier to read if it test function names were aligned, much like gofmt treats struct definitions. Here's what it normally looks like:

=== RUN TestGroupContextListings
--- PASS: TestGroupContextListings (0.00s)
=== RUN TestIdentifyCompletedTasks
--- FAIL: TestIdentifyCompletedTasks (0.00s)
=== RUN TestIdentifyStalledProjects
--- PASS: TestIdentifyStalledProjects (0.00s)
=== RUN TestIdentifyFinishedProjects
--- PASS: TestIdentifyFinishedProjects (0.00s)
FAIL
exit status 1
FAIL    github.com/blahblah/blah    0.004s

Here's how a tiny bit of formatting could improve things:

=== RUN   TestGroupContextListings
--- PASS: TestGroupContextListings (0.00s)
=== RUN   TestIdentifyCompletedTasks
--- FAIL: TestIdentifyCompletedTasks (0.00s)
=== RUN   TestIdentifyStalledProjects
--- PASS: TestIdentifyStalledProjects (0.00s)
=== RUN   TestIdentifyFinishedProjects
--- PASS: TestIdentifyFinishedProjects (0.00s)
FAIL
exit status 1
FAIL    github.com/blahblah/blah    0.004s

@robpike robpike self-assigned this Apr 28, 2015

@robpike robpike added this to the Go1.5 milestone Apr 28, 2015

@robpike

This comment has been minimized.

Copy link
Contributor

commented Apr 28, 2015

All that would be needed for those using a fixed-width font would be to add two spaces after "RUN". I am a little bothered by the inconsistency of "RUN" vs "PASS:", the latter having a colon, but it's inconsistent in having the time as well.

In the likely event no one depends on the particular format, this issue is trivial. After all, it's -v output.

@robpike robpike closed this Apr 28, 2015

@mdwhatcott

This comment has been minimized.

Copy link
Author

commented Apr 28, 2015

I'm unsure of the status of this issue (I'm new to the workflow here). The issue was closed, but I don't think the idea was rejected (?). @robpike, is there something I should do to move this forward?

@josharian

This comment has been minimized.

Copy link
Contributor

commented Apr 28, 2015

Given that @robpike added this to the Go1.5 milestone, and given his comment, I think that it was closed by accident. Re-opening.

If we're repainting sheds, we could reduce the noise levels while we're at it and remove those pesky inconsistent colons:

=== RUN   TestGroupContextListings
    PASS  TestGroupContextListings (0.00s)
=== RUN   TestIdentifyCompletedTasks
    FAIL  TestIdentifyCompletedTasks (0.00s)
=== RUN   TestIdentifyStalledProjects
    PASS  TestIdentifyStalledProjects (0.00s)
=== RUN   TestIdentifyFinishedProjects
    PASS  TestIdentifyFinishedProjects (0.00s)
FAIL

I thought briefly that the hyphens might be to help keep things roughly aligned for those using variable-width fonts, but hyphens have different width than equal signs anyway. If we want that, an en dash will be much closer:

=== RUN   TestGroupContextListings
––– PASS  TestGroupContextListings (0.00s)
=== RUN   TestIdentifyCompletedTasks
––– FAIL  TestIdentifyCompletedTasks (0.00s)
=== RUN   TestIdentifyStalledProjects
––– PASS  TestIdentifyStalledProjects (0.00s)
=== RUN   TestIdentifyFinishedProjects
––– PASS  TestIdentifyFinishedProjects (0.00s)
FAIL

@josharian josharian reopened this Apr 28, 2015

@josharian josharian changed the title Why not 'fmt' (align) go test -v output? testing: align -v output Apr 28, 2015

@mdwhatcott

This comment has been minimized.

Copy link
Author

commented Apr 28, 2015

Thanks @josharian for re-opening and for adding your thoughts. I like where you're taking it.

@robpike

This comment has been minimized.

Copy link
Contributor

commented Apr 28, 2015

Not sure why I closed it. I didn't mean to: I plan to fix it.

I'm not going with em dashes. Since it's about alignment, the assumption is fixed width fonts and ASCII characters or it all comes apart.

@mdwhatcott

This comment has been minimized.

Copy link
Author

commented Apr 28, 2015

Thanks @robpike.

@dchapes

This comment has been minimized.

Copy link

commented Apr 29, 2015

@josharian the "---" might be there to help separate that from t.Log output, or perhaps to make it easier to distinguish from the final PASS/FAIL or somesuch.

I.e. consider fuller output:

=== RUN TestA
--- PASS: TestA (0.00s)
=== RUN TestB
--- PASS: TestB (0.00s)
        b_test.go:25: some log message
        b_test.go:26: and another
PASS

I've see some multi-line t.Log messages use "\n\t…" to line up so it'd be nice to not change the leading tab used for those.

@robpike robpike closed this in 2b83366 May 8, 2015

@msteinert msteinert referenced this issue Jun 12, 2015

Merged

Fixes for 1.5 #317

@golang golang locked and limited conversation to collaborators Jun 25, 2016

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.