...

Package scripttest

import "cmd/go/internal/script/scripttest"
Overview
Index

Overview ▾

Package scripttest adapts the script engine for use in tests.

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:

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.