luci: Index | Files

package starlarktest

import ""

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.


Package Files


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
    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.

Package starlarktest imports 10 packages (graph). Updated 2021-01-20. Refresh now. Tools for package owners.