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

Allow template tests to have trailing empty lines #745

Merged
merged 4 commits into from
Sep 23, 2022

Conversation

mamachanko
Copy link
Contributor

This makes it easier to author template tests, because editors tend to append a newline when saving files.

Previously, ERR: template test could not have trailing empty lines. I am using both Vim and IntelliJ. Both make it hard to remove the last line break in the file. I spend a minute to figure it out, and in Vim you can do :set noendofline binary for a buffer and it trims trailing whitespace. But that's a bother.

I think it is better testing UX this way. I held back from letting my IDE add a line break to existing *.tpltest.

This makes it easier to author template tests, because
editors tend to append a newline when saving files.
@mamachanko
Copy link
Contributor Author

@pivotaljohn thank you so much for taking action and addressing the linter-flagged issues! The failing PR checks were overlooked by me. 🙇🏻

Furthermore, I forgot to mention that test/filetests/filetests_test.go tests both for spaces and tabs, but GitHub doesn't display whitespace characters sufficiently different (which is what one wants most of the time), e.g.

├──┤├──┤├──┤give`␊
we␊

··want├──┤␊
├──┤yaml␊

`,␊
├──┤├──┤├──┤want`␊
we␊

··want␊
├──┤yaml`,␊

Copy link
Contributor

@pivotaljohn pivotaljohn left a comment

Choose a reason for hiding this comment

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

With this, you've eliminated one of the last (the last?) vestiges of pain around writing these kinds of tests. That's important because this style of testing ought to be the workhorse for this codebase.

🙏🏻

@pivotaljohn pivotaljohn merged commit bfc92d2 into carvel-dev:develop Sep 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants