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

Colorize the diffs produced by assert.Equal #1479

Open
mitioshi opened this issue Oct 5, 2023 · 0 comments
Open

Colorize the diffs produced by assert.Equal #1479

mitioshi opened this issue Oct 5, 2023 · 0 comments
Labels
enhancement: colored output About adding colored output enhancement pkg-assert Change related to package testify/assert

Comments

@mitioshi
Copy link

mitioshi commented Oct 5, 2023

When running tests in IDE/text editor, it's difficult to analyze the diffs produced by assert.Equal without somehow highlighting the different lines. This could be improved by making diff colorized. That is, make the "expected" lines red and make the "actual" lines green. The result could be similar to what https://github.com/mcmire/super_diff/tree/main provides

Teistify uses difflib that is no longer maintained and cannot be extended to modify the diff structure, so it might be better to switch to another library: https://github.com/sergi/go-diff. It provides structured diffs and can be used to colorize the output

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement: colored output About adding colored output enhancement pkg-assert Change related to package testify/assert
Projects
None yet
Development

No branches or pull requests

2 participants