Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var TestData = func(t testing.TB) string { t.Helper() testdata, err := filepath.Abs("testdata") if err != nil { t.Fatal(err) } return testdata }
TestData returns absolute path of testdata. If TestData cannot get the path, the test will be failed.
Functions ¶
This section is empty.
Types ¶
type Result ¶
type Result = checker.AnalyzerResult
Result is a result of an analyzer.
func Run ¶
Run runs tests for an analyzer. The given directries which are in testdata, have "schema" and "query" directory. Run applies the analyzer for schemas and queries which are hold on these directories. Run checks whether expected diagnostics is reported and unexpected ones are not by the analyzer. An expected diagnostic can be written with a comment in a .graphql file. The comment begin "want" and a Go's regular expression folows it. For example, if the analyzer must report "NG" as a diagnostic, it can test with such as following.
query Q() { a { # want "NG" name } }