Skip to content

Latest commit

 

History

History
23 lines (16 loc) · 773 Bytes

README.md

File metadata and controls

23 lines (16 loc) · 773 Bytes

fix - Golden Files Testing library for Go

Go Reference

This library, like Ruby's vcr, serializes the results once executed and saves them as a file. You can easily write tests to verify that the code outputs the same results as in the past, even after modifying the code.

go get github.com/juntaki/fix

How to use

Append code like below to your tests. and Run test twice.

err := fix.Fix(&output) // output is dumped to a file.
if err != nil {
  t.Fatal(err)
}

First test will fail, because juntaki/fix writes serialized data to file. From the second time, the test will pass, if output is the same as first output.