scripttest

package standard library
go1.21.10 Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package scripttest adapts the script engine for use in tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CachedExec

func CachedExec() script.Cond

CachedExec returns a Condition that reports whether the PATH of the test binary itself (not the script's current environment) contains the named executable.

func DefaultCmds

func DefaultCmds() map[string]script.Cmd

DefaultCmds returns a set of broadly useful script commands.

This set includes all of the commands in script.DefaultCmds, as well as a "skip" command that halts the script and causes the testing.TB passed to Run to be skipped.

func DefaultConds

func DefaultConds() map[string]script.Cond

DefaultConds returns a set of broadly useful script conditions.

This set includes all of the conditions in script.DefaultConds, as well as:

  • Conditions of the form "exec:foo" are active when the executable "foo" is found in the test process's PATH, and inactive when the executable is not found.

  • "short" is active when testing.Short() is true.

  • "verbose" is active when testing.Verbose() is true.

func Run

func Run(t testing.TB, e *script.Engine, s *script.State, filename string, testScript io.Reader)

Run runs the script from the given filename starting at the given initial state. When the script completes, Run closes the state.

func Skip

func Skip() script.Cmd

Skip returns a sentinel error that causes Run to mark the test as skipped.

Types

This section is empty.

Jump to

Keyboard shortcuts

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