startest

package
v2.9.4 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunTest

func RunTest(t *testing.T, script string, opts ourstar.Options)

RunTest runs an on-disk Starlark test. Tests are scripts that produce functions that start with the name "test_", and take a *testing.T object as their first argument. The tests work like Go tests; t.Error fails the test and continues, t.Fatal aborts the test. Each Starlark test function is run as a subtest of a "starlark" test created by this command. Starlark tests cannot call t.Parallel, since we use the same Starlark thread for each test, but there is no reason why this stipulation cannot be removed.

Types

type T

type T interface {
	Run(string, func(T)) bool
	Helper()
	Log(...any)
	Logf(string, ...any)
	Error(...any)
	Errorf(string, ...any)
	Fatal(...any)
	Fatalf(string, ...any)
}

T is a subset of testing.TB for Starlark tests. We don't attempt to implement testing.TB because it contains a private field to prevent people from implementing it. We also have Run. We are playing these games so that the "failing tests" test suite can run against either a testing.T (to see that the fail while developing), or a recorder (to see that they continue to "fail" according to the spec; i.e. all the Go tests will pass, when the Go tests are running intentionally-failing Starlark tests).

Jump to

Keyboard shortcuts

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