progtest

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2024 License: BSD-2-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package progtest contains utilities for wrapping prog.Program instances into Elvish functions, so that they can be tested using the src.elv.sh/pkg/eval/evaltest framework.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ElvishInGlobal added in v0.21.0

func ElvishInGlobal(p prog.Program) func(ev *eval.Evaler)

ElvishInGlobal returns a setup function suitable for the evaltest framework, which creates a function called "elvish" in the global scope that invokes the given program.

func ProgramAsGoFn added in v0.21.0

func ProgramAsGoFn(p prog.Program) any

ProgramAsGoFn converts a prog.Program to a Go-implemented Elvish function.

Stdin of the program is connected to the stdin of the function.

Stdout of the program is usually written unchanged to the stdout of the function, except when:

  • If the output has no trailing newline, " (no EOL)\n" is appended.
  • If &check-stdout-contains is supplied, stdout is suppressed. Instead, a tag "[stdout contains foo]" is shown, followed by "true" or "false".

Stderr of the program is written to the stderr of the function with a [stderr] prefix, with similar treatment for missing trailing EOL and &check-stderr-contains.

If the program exits with a non-zero return value, a line "[exit] $i" is written to stderr.

Types

This section is empty.

Jump to

Keyboard shortcuts

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