golden

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package golden provides tools for fixture testing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type G

type G struct {
	ShouldUpdate bool

	FixtureDir    string
	FixturePrefix string
	FixtureSuffix string
	// contains filtered or unexported fields
}

G is the object that assertions are made on.

func New

func New(t testing.TB) G

New creates a new, ready to use G.

func (G) Assert

func (g G) Assert(name string, got []byte)

Assert asserts, that the given byte slice has the same content as a file, whose path is derived from the given name (usually "testdata/"+name+".golden").

func (G) AssertStruct

func (g G) AssertStruct(name string, got interface{})

AssertStruct asserts, that the given struct has the same content as a file, whose path is derived from the given name (usually "testdata/"+name+".golden"). This is ensured by gob-encoding the given struct and comparing it against the file's contents.

Jump to

Keyboard shortcuts

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