Documentation
¶
Overview ¶
Package testcorpus provides shared infrastructure for fidelity tests that run the curated SQL corpus through various parser and formatter APIs. It owns the parser-version constant, the `-- minparser:` pragma extraction, and the corpus-enumeration loop so that each fidelity test only needs to supply its assertion callback.
Index ¶
Constants ¶
const CurrentParserVersion = "v0.26.2"
CurrentParserVersion is the cockroachdb-parser module version this build is pinned against. It must be kept in lockstep with the `replace` directive in go.mod (currently github.com/spilchen/cockroachdb-parser v0.26.2).
It is hardcoded rather than read from debug.ReadBuildInfo because `go test` binaries do not populate BuildInfo.Deps — the same constraint observed by the version subcommand (see cmd/version.go). Bump this constant in the same commit that bumps the replace directive.
Variables ¶
This section is empty.
Functions ¶
func ForEachFile ¶
ForEachFile enumerates .sql files in corpusDir, creating a subtest per file. For each file it extracts the optional `-- minparser:` pragma and skips the subtest when CurrentParserVersion is below the required minimum. The file's content is passed to fn as a string.
corpusDir is resolved relative to the calling package's directory since `go test` sets CWD to the package under test.
Types ¶
This section is empty.