Skip to content

nochso/golden

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

golden

MIT license GitHub release GoDoc
Go Report Card Build Status Coverage Status

Package golden helps writing golden tests.

A golden test (a.k.a. gold master or approval test) consists of pairs of files: given test input and expected output (the gold master).

This package is mainly intended to be used with the standard Go testing library. You can still use it without. It is not intended to be a full testing framework.

Installation

go get github.com/nochso/golden

Documentation

See godoc for API docs and examples.

Notes

It's important that golden files are easy to read, edit and diff. Usually it's enough to add a String() string method or more detailed TestString, debugString, etc. to dump the data you want to compare in a human readable way.

Any methods that could fail and have access to T (as in testing.T) will call T.Error(err). If T is nil, log.Println(err) is called instead. This mainly concerns Case and File structs and any methods mentioning failing.

Changes / Versioning

All notable changes to this project will be documented in CHANGELOG.md

This project adheres to Semantic Versioning.

License

This package is released under the MIT license.