Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var TestData = analysistest.TestData
Functions ¶
func Golden ¶
Golden compares the results with golden files. Golden creates read a golden file which name is codegen.Generator.Name + ".golden". The golden file is stored in same directory of the package. If Golden cannot find a golden file or the result of Generator test is not same with the golden, Golden reports error via *testing.T. If update is true, golden files would be updated.
var flagUpdate bool func TestMain(m *testing.M) { flag.BoolVar(&flagUpdate, "update", false, "update the golden files") flag.Parse() os.Exit(m.Run()) } func TestGenerator(t *testing.T) { rs := codegentest.Run(t, codegentest.TestData(), example.Generator, "example") codegentest.Golden(t, rs, flagUpdate) }
Types ¶
Click to show internal directories.
Click to hide internal directories.