Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertDirEqual ¶
func AssertDirEqual(t *testing.T, root string, options ...AssertOption)
AssertDirEqual asserts that each file located under root is byte-for-byte identical with it's corresponding golden file. It also asserts on the directory structure itself.
To update files under test, use:
go test ./... -update
WARNING: Multiple AssertDirEqual should not run in the same go test. If you need to call AssertDirEqual more then once in a test, place each in a subtest:
t.Run("docs", func(t *testing.T) { util.AssertDirEqual(t, baseDocsOutDir) }) t.Run("tree", func(t *testing.T) { util.AssertDirEqual(t, basePackageTreeJSONOutDir) })
func AssertDirsEqual ¶
func AssertDirsEqual(t *testing.T, expected, actual string, options ...AssertOption)
AssertDirsEqual asserts that the file-tree at actual matches the file-tree at expected.
If you just want to assert that a directory structure is unchanged or show updates, see AssertDirEqual. AssertDirsEqual is about showing that two already written out directories are equivalent.
Types ¶
type AssertOption ¶
type AssertOption func(*assertOptions)
func AssertOptionsPreCompareTransform ¶
func AssertOptionsPreCompareTransform(regex, with string) AssertOption
Apply a regexp based transformation to all files before they are used in comparison..