sebdah / goldie

Golden file testing for Go
MIT License
228 stars 19 forks source link

Template fixtures break non-text fixtures #11

Closed jakdept closed 5 years ago

jakdept commented 5 years ago

It appears that in commit f0e441682ff73cf164ffd4f0cb53978f0f29a7ff when template support was added, everything now uses template support. Also, template support breaks if you use an image, or other non-text file for your fixture. text/template.Parse() cannot parse non text and thus fails that function before getting to bytes.Equal().

Minimal changes I think are to move https://github.com/sebdah/goldie/blob/master/goldie.go#L123 up above the Template code, return nil if match, and go onto the template work if not exact match? But then probably also add a PNG image template + test for a regression test?