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 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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