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
Closed

testing: align -v output #10594

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

Comments

@mdwhatcott
Copy link

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
Copy link
Contributor

robpike 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 as completed Apr 28, 2015
@mdwhatcott
Copy link
Author

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
Copy link
Contributor

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
Copy link
Author

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

@robpike
Copy link
Contributor

robpike 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
Copy link
Author

Thanks @robpike.

@dchapes
Copy link

dchapes 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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants