testify icon indicating copy to clipboard operation
testify copied to clipboard

Colorize the diffs produced by assert.Equal

Open mitioshi opened this issue 2 years ago • 0 comments

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

mitioshi avatar Oct 05 '23 16:10 mitioshi