testable

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2026 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package testable contains code to make npte testable.

Index

Constants

This section is empty.

Variables

Env is the global *Environ.

Functions

This section is empty.

Types

type Environ

type Environ struct {
	Args             []string
	Exit             func(code int)
	Stdin            io.Reader
	Stdout           io.Writer
	Stderr           io.Writer
	LogRenderer      *lipgloss.Renderer
	Getenv           func(key string) string
	Geteuid          func() int
	MkdirAll         func(path string, perm os.FileMode) error
	ReadFile         func(name string) ([]byte, error)
	WriteFile        func(name string, data []byte, perm os.FileMode) error
	Stat             func(name string) (os.FileInfo, error)
	Remove           func(name string) error
	ReadDir          func(name string) ([]os.DirEntry, error)
	RunCommand       func(cmd *exec.Cmd) error
	LookPath         func(file string) (string, error)
	Executable       func() (string, error)
	LockFile         func(path string) (func(), error)
	LogFatalOnError0 func(err error)
}

Environ abstracts away side effects (filesystem, execution, locking, exit) so that commands can be tested without root, namespaces, or real I/O.

func NewEnvironOS

func NewEnvironOS() *Environ

NewEnvironOS returns an *Environ wired to real OS operations.

Jump to

Keyboard shortcuts

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