testutil

package
v3.0.0-...-8e3f9f9 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: Apache-2.0 Imports: 14 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 testutil provides multi-dialect test runners and helpers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BigQueryEnvFactory

func BigQueryEnvFactory() func(envSetup string) (*EnvResult, error)

BigQueryEnvFactory returns an environment factory for BigQuery tests. It uses the same CEL environments as PostgreSQL (CEL compilation is dialect-independent) but sets the BigQuery dialect for SQL generation.

func DialectEnvFactory

func DialectEnvFactory(d dialectpkg.Name) func(envSetup string) (*EnvResult, error)

DialectEnvFactory returns an environment factory for the given dialect. This is a convenience function that maps dialect names to their env factories.

func DuckDBEnvFactory

func DuckDBEnvFactory() func(envSetup string) (*EnvResult, error)

DuckDBEnvFactory returns an environment factory for DuckDB tests. It uses the same CEL environments as PostgreSQL (CEL compilation is dialect-independent) but sets the DuckDB dialect for SQL generation.

func MySQLEnvFactory

func MySQLEnvFactory() func(envSetup string) (*EnvResult, error)

MySQLEnvFactory returns an environment factory for MySQL tests. It uses the same CEL environments as PostgreSQL (CEL compilation is dialect-independent) but sets the MySQL dialect for SQL generation.

func PostgreSQLEnvFactory

func PostgreSQLEnvFactory() func(envSetup string) (*EnvResult, error)

PostgreSQLEnvFactory returns an environment factory for PostgreSQL tests.

func RunAllConvertTests

func RunAllConvertTests(
	t *testing.T,
	dialectName dialect.Name,
	envFactory func(envSetup string) (*EnvResult, error),
	opts ...cel2sql.ConvertOption,
)

RunAllConvertTests runs all standard test suites for a given dialect.

func RunAllParameterizedTests

func RunAllParameterizedTests(
	t *testing.T,
	dialectName dialect.Name,
	envFactory func(envSetup string) (*EnvResult, error),
	opts ...cel2sql.ConvertOption,
)

RunAllParameterizedTests runs all parameterized test suites for a given dialect.

func RunConvertTests

func RunConvertTests(
	t *testing.T,
	dialectName dialect.Name,
	cases []testcases.ConvertTestCase,
	envFactory func(envSetup string) (*EnvResult, error),
	opts ...cel2sql.ConvertOption,
)

RunConvertTests runs a set of ConvertTestCase entries for a given dialect. envFactory returns an EnvResult (CEL env + convert options) for the given EnvSetup key. Additional opts are appended after any env-specific options.

func RunParameterizedTests

func RunParameterizedTests(
	t *testing.T,
	dialectName dialect.Name,
	cases []testcases.ParameterizedTestCase,
	envFactory func(envSetup string) (*EnvResult, error),
	opts ...cel2sql.ConvertOption,
)

RunParameterizedTests runs a set of ParameterizedTestCase entries for a given dialect.

func SQLiteEnvFactory

func SQLiteEnvFactory() func(envSetup string) (*EnvResult, error)

SQLiteEnvFactory returns an environment factory for SQLite tests. It uses the same CEL environments as PostgreSQL (CEL compilation is dialect-independent) but sets the SQLite dialect for SQL generation.

Types

type EnvResult

type EnvResult struct {
	Env  *cel.Env
	Opts []cel2sql.ConvertOption
}

EnvResult holds both the CEL environment and convert options needed for testing.

func NewDefaultEnv

func NewDefaultEnv() (*EnvResult, error)

NewDefaultEnv creates a basic CEL environment with standard variable types.

func NewJSONSchemaEnv

func NewJSONSchemaEnv() (*EnvResult, error)

NewJSONSchemaEnv creates a CEL environment with a JSON-enabled schema type provider.

func NewTimestampEnv

func NewTimestampEnv() (*EnvResult, error)

NewTimestampEnv creates a CEL environment with timestamp-related types and functions.

Jump to

Keyboard shortcuts

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