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.

Source Files