Documentation ¶
Overview ¶
Package golden contains objects to manage updating an search in golden files.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DataDir = "testdata" FlagName = "update" FilePerms os.FileMode = 0644 DirPerms os.FileMode = 0755 )
View Source
var ( // ErrFileNotFoundInDataDir is thrown when the file to open isn't // found on data dir. ErrFileNotFoundInDataDir = errors.New("file not founded in data dir") )
View Source
var ( // ErrInvalidKeyPrefix it's an error returned when gold.Get is called with key starting with wrong format. ErrInvalidKeyPrefix = errors.New("the golden key must be prefixed by 'input.' or 'golden.'") )
View Source
var ( // ErrWrongKeySequence is thrown when user tries to walk through // invalid sequence of maps and keys. ErrWrongKeySequence = errors.New("invalid key sequence for golden file") )
Functions ¶
This section is empty.
Types ¶
type ErrDataDirIsFile ¶
type ErrDataDirIsFile struct {
// contains filtered or unexported fields
}
ErrDataDirIsFile is an error thrown when the data folder, with the golden files is a file.
func NewErrDataDirIsFile ¶
func NewErrDataDirIsFile(file string) (err *ErrDataDirIsFile)
NewErrDataDirIsFile creates an ErrDataDirIsFile with the file founded.
func (*ErrDataDirIsFile) Error ¶
func (e *ErrDataDirIsFile) Error() (m string)
Error prints the reason for error, telling which file was found.
type Gold ¶
type Gold struct { Input interface{} `json:"input" yaml:"input"` Golden interface{} `json:"golden" yaml:"golden"` }
Gold contains information about a test case on a golden file, separated in Input and Golden.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager load a golden file for a Feature, and then separates into various test cases.
func NewManager ¶
NewManager creates a manager, using the feature tested and given context.
func (*Manager) NumGoldies ¶
NumGoldies return number of test cases loaded with manager to a single feature.
Click to show internal directories.
Click to hide internal directories.