cuetdtest

package
v0.12.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package testing is a helper package for test packages in the CUE project. As such it should only be imported in _test.go files.

Index

Constants

View Source
const DefaultVersion = "v2"

Variables

This section is empty.

Functions

func Run

func Run[TC any](t *testing.T, table []TC, fn func(t *T, tc *TC))

Run creates a new table-driven test using the CUE testing defaults.

Types

type M

type M struct {
	// Flags is public to allow tests to customise e.g. logging.
	Flags cuedebug.Config
	// contains filtered or unexported fields
}

M represents a point in the evaluation matrix of possible runtime configurations.

func (*M) CueContext added in v0.11.0

func (t *M) CueContext() *cue.Context

func (*M) Fallback

func (t *M) Fallback() string

func (*M) IsDefault

func (t *M) IsDefault() bool

func (*M) Name

func (t *M) Name() string

func (*M) Runtime

func (t *M) Runtime() *runtime.Runtime

Runtime creates a runtime that is configured according to the matrix.

func (*M) TODO_NoSharing

func (m *M) TODO_NoSharing(t testing.TB)

func (*M) TODO_Sharing

func (m *M) TODO_Sharing(t testing.TB)

func (*M) TODO_V3

func (m *M) TODO_V3(t testing.TB)

type Matrix

type Matrix []M
var DefaultOnlyMatrix Matrix = FullMatrix[:1]
var DevOnlyMatrix Matrix = FullMatrix[1:2]
var FullMatrix Matrix = []M{{
	// contains filtered or unexported fields
}, {

	Flags: cuedebug.Config{Sharing: true},
	// contains filtered or unexported fields
}, {
	// contains filtered or unexported fields
}}
var SmallMatrix Matrix = FullMatrix[:2]

func (Matrix) Do

func (m Matrix) Do(t *testing.T, f func(t *testing.T, m *M))

Do runs f in a subtest for each configuration in the matrix.

func (Matrix) Run

func (m Matrix) Run(t *testing.T, name string, f func(t *testing.T, m *M))

Run runs a subtest with the given name that invokes a further subtest for each configuration in the matrix.

type T

type T struct {
	*tdtest.T
	M *M
}

Jump to

Keyboard shortcuts

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