testhelpers

package
v0.0.0-...-68a35d0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const EnvGenerateSnapshots = "GROQ_TEST_GENERATE_SNAPSHOTS"

Variables

This section is empty.

Functions

func ASTTest

func ASTTest(
	t *testing.T,
	test *Test,
	outputDir string,
	parser func(query string, params groq.Params) (ast.Expression, error),
)

func ReadSnapshot

func ReadSnapshot(t *testing.T, fileName string, data []byte) []byte

ReadSnapshot reads a snapshot file. If it doesn't exist, the provided data is written, but only if the EnvVarGenerateSnapshots envvar is set.

func SnapshotFileName

func SnapshotFileName(test *Test) string

func WithEachTest

func WithEachTest(t *testing.T, f func(t *testing.T, test *Test))

Types

type Test

type Test struct {
	Name     string
	Query    string
	Params   groq.Params
	Valid    bool
	Version  *semver.Range
	FileName string
}

Jump to

Keyboard shortcuts

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