golden

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2017 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package golden provides tools for comparing large mutli-line strings.

Golden files are files in the ./testdata/ subdirectory of the package under test.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Assert

func Assert(t require.TestingT, actual string, filename string, msgAndArgs ...interface{}) bool

Assert compares the actual content to the expected content in the golden file. If the `-test.update-golden` flag is set then the actual content is written to the golden file. Returns whether the assertion was successful (true) or not (false)

Example
Assert(t, "foo", "foo-content.golden")
Output:

func AssertBytes

func AssertBytes(t require.TestingT, actual []byte, filename string, msgAndArgs ...interface{}) bool

AssertBytes compares the actual result to the expected result in the golden file. If the `-test.update-golden` flag is set then the actual content is written to the golden file. Returns whether the assertion was successful (true) or not (false) nolint: lll

Example
AssertBytes(t, []byte("foo"), "foo-content.golden")
Output:

func Get

func Get(t require.TestingT, filename string) []byte

Get returns the golden file content

func Path

func Path(filename string) string

Path returns the full path to a golden file

Types

This section is empty.

Jump to

Keyboard shortcuts

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