shellxtesting

package
v3.17.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2023 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package shellxtesting supports shellx testing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CmdEnvironMinusOsEnviron

func CmdEnvironMinusOsEnviron(c *execabs.Cmd) []string

CmdEnvironMinusOsEnviron removes the environment variables in os.Environ from the ones inside the given command. Note that the variables in os.Environ and in the command are like name=value, therefore, if you have HOME=/home/sbs in os.Environ and have HOME=/tmp in the command, you'll get HOME=/tmp in output.

func MustArgv

func MustArgv(c *execabs.Cmd) []string

MustArgv returns the execabs.Cmd's Argv or panics.

func WithCustomLibrary

func WithCustomLibrary(library shellx.Dependencies, fn func())

WithCustomLibrary executes the given function with a custom shellx.Library.

Types

type Library

type Library struct {
	MockCmdOutput func(c *execabs.Cmd) ([]byte, error)

	MockCmdRun func(c *execabs.Cmd) error

	MockLookPath func(file string) (string, error)
}

Library implements shellx.Dependencies.

func (*Library) CmdOutput

func (lib *Library) CmdOutput(c *execabs.Cmd) ([]byte, error)

CmdOutput implements shellx.Dependencies

func (*Library) CmdRun

func (lib *Library) CmdRun(c *execabs.Cmd) error

CmdRun implements shellx.Dependencies

func (*Library) LookPath

func (lib *Library) LookPath(file string) (string, error)

LookPath implements shellx.Dependencies

Jump to

Keyboard shortcuts

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