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: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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