goldendir
A package compatible with go test
to support golden file testing patterns but on directories.
Detailed Output
goldendir
makes it easy to spot differences.
For example:
+ extrafile
- missingfile
~ changedfile [
--- Expected
+++ Actual
@@ -1,3 +1,3 @@
content
-bar
+foo
]
+ dir/extrafile1
- dir/missingfile1
Example
import (
"testing"
"github.com/seriousben/goldendir"
)
func TestOutput(t *testing.T) {
goldendir.Assert(t, "/path/to/foo-dir", "foo-dir.golden")
}
Install
go get -u github.com/seriousben/goldendir
Related
- gotestyourself/golden - compare large multi-line strings
- testify/assert and testify/require - assertion libraries with common assertions