Documentation
¶
Overview ¶
Package testutil provides multi-dialect test runners and helpers.
Index ¶
- func BigQueryEnvFactory() func(envSetup string) (*EnvResult, error)
- func DialectEnvFactory(d dialectpkg.Name) func(envSetup string) (*EnvResult, error)
- func DuckDBEnvFactory() func(envSetup string) (*EnvResult, error)
- func MySQLEnvFactory() func(envSetup string) (*EnvResult, error)
- func PostgreSQLEnvFactory() func(envSetup string) (*EnvResult, error)
- func RunAllConvertTests(t *testing.T, dialectName dialect.Name, ...)
- func RunAllParameterizedTests(t *testing.T, dialectName dialect.Name, ...)
- func RunConvertTests(t *testing.T, dialectName dialect.Name, cases []testcases.ConvertTestCase, ...)
- func RunParameterizedTests(t *testing.T, dialectName dialect.Name, ...)
- func SQLiteEnvFactory() func(envSetup string) (*EnvResult, error)
- type EnvResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BigQueryEnvFactory ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
NewDefaultEnv creates a basic CEL environment with standard variable types.
func NewJSONSchemaEnv ¶
NewJSONSchemaEnv creates a CEL environment with a JSON-enabled schema type provider.
func NewTimestampEnv ¶
NewTimestampEnv creates a CEL environment with timestamp-related types and functions.