starlarktest

package
v0.0.0-...-01cd1ea Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package starlarktest contains utilities for running Starlark tests.

It knows how to run all *.star tests from some particular directory, adding 'assert' module to their global dict and wiring their errors to testing.T.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HookThread

func HookThread(th *starlark.Thread, t *testing.T)

HookThread makes a Starlark thread report errors and logs to the 't'.

func RunTests

func RunTests(t *testing.T, opts Options)

RunTests loads and executes all test scripts (testdata/**/*.star).

Types

type Options

type Options struct {
	TestsDir    string              // directory to search for *.star files
	Skip        string              // directories with this name are skipped
	Predeclared starlark.StringDict // symbols to put into the global dict

	// Executor runs a single starlark test file.
	//
	// If nil, RunTests will simply use starlark.ExecFile(...).
	Executor func(t *testing.T, path string, predeclared starlark.StringDict) error
}

Options describe where to discover tests and how to run them.

Directories

Path Synopsis
Package vendored is generated by go.chromium.org/luci/tools/cmd/assets.
Package vendored is generated by go.chromium.org/luci/tools/cmd/assets.

Jump to

Keyboard shortcuts

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