goldendir

package module
v0.0.0-...-f2b8a9a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 5, 2017 License: Apache-2.0 Imports: 8 Imported by: 0

README

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

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Assert

func Assert(t require.TestingT, actualDir, expectedDir string, msgAndArgs ...interface{}) bool

Assert compares the actual dir to the expected content in the golden dir. Returns whether the assertion was successful (true) or not (false)

Example
package main

import (
	"testing"

	"github.com/seriousben/goldendir"
)

var t = &testing.T{}

func main() {
	goldendir.Assert(t, "/path/to/foo-dir", "foo-dir.golden")
}

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL