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

Add test name text wrapping on small screens #124

Merged
merged 2 commits into from
Aug 9, 2024

Conversation

thisisamirmaleki
Copy link
Contributor

@thisisamirmaleki thisisamirmaleki commented Aug 7, 2024

This PR enables -smallscreen arg to wrap the name of the test if it's too long.

  • added test name wrap to shortenTestName

@thisisamirmaleki thisisamirmaleki changed the title add test name wrap to shortenTestName Add test name wrap to shortenTestName Aug 7, 2024
@thisisamirmaleki thisisamirmaleki changed the title Add test name wrap to shortenTestName Add test name text wrapping on small screens Aug 7, 2024
@mfridman
Copy link
Owner

mfridman commented Aug 7, 2024

Mind jotting down a before/after example?

@ccoVeille
Copy link
Contributor

I don't get it.

The only thing that changed is a test file.

The PR talks about adding a argument to tparse

@thisisamirmaleki
Copy link
Contributor Author

thisisamirmaleki commented Aug 7, 2024

@ccoVeille This is not a go test file. It's one of the app files.

@mfridman Sure.
I'm using GitLab CI (with certain screen size and like <100 characters console-like space) and tparse as a beautifier for my golang test output. I also have some tests which have huge names (more than 150 characters long). Even while using the -smallscreen argument, the test names aren't wrapped around and the table structure would break like this:
image
Instead we can wrap the text around and retain the table's visual structure:
image

@ccoVeille
Copy link
Contributor

This is not a go test file. It's one of the app files.

My bad, indeed the name table_testS.go confused me

testName.WriteString(" /")
for len(s) > maxLength {
testName.WriteString(s[:maxLength] + "\n ")
s = s[maxLength:]
Copy link
Contributor

Choose a reason for hiding this comment

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

I would recommend adding an ellipsis then. Either an Unicode character (my preference) or a three successive dots

Suggested change
s = s[maxLength:]
s = s[maxLength:]+"…"

@MehdiGhalenoii
Copy link

@ccoVeille This is not a go test file. It's one of the app files.

@mfridman Sure. I'm using GitLab CI (with certain screen size and like <100 characters console-like space) and tparse as a beautifier for my golang test output. I also have some tests which have huge names (more than 150 characters long). Even while using the -smallscreen argument, the test names aren't wrapped around and the table structure would break like this: image Instead we can wrap the text around and retain the table's visual structure: image

Good Idea!

Copy link
Owner

@mfridman mfridman left a comment

Choose a reason for hiding this comment

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

lgtm, thanks for contributing!

@mfridman mfridman merged commit 2d3f361 into mfridman:main Aug 9, 2024
3 checks passed
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.

4 participants