github.com/seriousben/goldendir

Assert in go tests using golden directories


License
Apache-2.0
Install
go get github.com/seriousben/goldendir

Documentation

goldendir

A package compatible with go test to support golden file testing patterns but on directories.

GoDoc CircleCI Go Reportcard codecov

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