Cool example for Debug.log! I hadn’t thought of that.
elm-review
uses the same idea for its testing module. For instance, when your rule suggests a fix, the testing module checks whether the source code after the fix matches what was expected. If it doesn’t, it lets you know by showing you the actual and expected source code.
But sometimes, this can be hard to read when the difference is only whitespace, which is why when that happens a special message shows up where the whitespace is highlighted, and it looks like this:
The red at the top is the test title (colored by elm-test
), then comes the error type (Fixed code mismatch) colored by the test module.
I have been made aware of that these colors don’t disappear when you run elm-test
with --no-color
, which is not ideal. I further described this approach in Great compiler messages? Great test failure messages!