-
-
Notifications
You must be signed in to change notification settings - Fork 17
/
options.go
36 lines (29 loc) · 956 Bytes
/
options.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package autogold
// Option configures specific behavior for Equal.
type Option interface {
// isValidOption is an unexported field to ensure only valid options from this package can be
// used.
isValidOption()
}
type option struct {
name string
exportedOnly bool
dir string
// internal options.
forPackageName, forPackagePath string
allowRaw bool
trailingNewline bool
}
func (o *option) isValidOption() {}
// ExportedOnly is an option that includes exported fields in the output only.
func ExportedOnly() Option {
return &option{exportedOnly: true}
}
// Name specifies a name to use for the testdata/<name>.golden file instead of the default test name.
func Name(name string) Option {
return &option{name: name}
}
// Dir specifies a customer directory to use for writing the golden files, instead of the default "testdata/".
func Dir(dir string) Option {
return &option{dir: dir}
}