luci: go.chromium.org/luci/starlark/starlarktest Index | Files

package starlarktest

import "go.chromium.org/luci/starlark/starlarktest"

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

Package Files

runner.go

func HookThread Uses

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

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

func RunTests Uses

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

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

type Options Uses

type Options struct {
    TestsDir    string              // directory to search for *.star files
    Predeclared starlark.StringDict // symbols to put into the global dict

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

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

Package starlarktest imports 10 packages (graph). Updated 2018-12-14. Refresh now. Tools for package owners.