testcorpus

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 24, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

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

View Source
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

func ForEachFile(t *testing.T, corpusDir string, fn func(t *testing.T, sql string))

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL