Documentation
¶
Overview ¶
Package goldenfile implement simplistic goldenfile parsing in a format similar to TreeSitter tests.
Unlike TreeSitter we do not support any additional test-data (such as skipping tests, or multi-file input).
Each file contains one or more tests. The name musst be enclosed by at least three equal-signs (`===`). The input text and expected text musst be separated by at least three minuses (`---`):
``` === Test 1 === input of test 1 --- wanted output of test 1
=== Test 2 === --- ```
Example ¶
tests, _ := goldenfile.Parse(os.Stdin)
for _, test := range tests {
fmt.Printf("Test: %+n")
}
Updating files ¶
The package add a new command line flag `-update` to go test. This flags can be checked by the user and let update the goldenfiles. See the example in the repository for details.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
Update = flag.Bool("update", false, "update golden files")
)