Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StringsDiff ¶
StringsDiff returns a pretty diff between given strings
Types ¶
type Context ¶
type Context struct { Dir string DirMode os.FileMode FileMode os.FileMode FileExtension string AutoUpdate bool AutoUpdateSnapshots []string // contains filtered or unexported fields }
Context is used to isolate snapshot testing for given options
func NewContext ¶
NewContext creates a new snapshot testing context
By default the `AutoUpdate` will be enabled according to `-update` or `-u` command-line flag, if it equals `all` `AutoUpdate` will be enabled.
If the update flag is set but doesn't equal `all`, then its value will be split using a comma, this allows to update specific snapshots only, if the snapshot's name matches one of the extracted value it will be updated, otherwise code has to be fixed :)
Note that even if it initially uses flag value, you can manually set `AutoUpdate` & `AutoUpdateSnapshots` manually.
func (*Context) NewSnapshot ¶
NewSnapshot creates a new snapshot attached to context. If a snapshot with the same name already exists, test will fail.
type Snapshot ¶
type Snapshot struct { Name string // contains filtered or unexported fields }
Snapshot represents a snapshot file
func (*Snapshot) AssertString ¶
AssertString test given string against stored content