UnkindPartition / tasty-golden

Golden test support for Tasty
MIT License
36 stars 15 forks source link

Non-textual output #51

Open andrewthad opened 2 years ago

andrewthad commented 2 years ago

I'm using goldenVsString to check that I correctly encode something to a binary output format (protobuf, but CBOR or anything non-textual would demonstrate this same problem). When the output doesn't match, tasty-golden throws an exception. This happens because unpackUtf8 calls one of the decodeUtf8 functions from text. The result of this is that I can use tasty-golden, but it crashes whenever the output changes, and then I run it with the --accept flag and everything works after that.

I'd like to modify the behavior so that if either the expected output or the actual output are not UTF-8 encoded text, then the "Test output was different from A, It was B" message is suppressed. It could just say "Test output was different. Not attempting to show non-textual content."

I can implement this if the maintainers find it agreeable.

andrewthad commented 1 year ago

I am still regularly impacted by this issue in several libraries where I test functions for encoding to non-text formats.