vos

package
v0.0.0-...-3eca47f Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package vos is a virtual os tool. It allows mocking of the os.Environ, os.Getenv and os.Getwd functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Env

type Env interface {
	Environ() []string

	Getenv(key string) string
	Getwd() (string, error)
	Stdout() io.Writer
	Stderr() io.Writer
	Stdin() io.Reader

	Setenv(key, value string) error
	Setwd(dir string) error
	Setstdout(io.Writer)
	Setstderr(io.Writer)
	Setstdin(io.Reader)
}

Env provides an interface with methods similar to os.Environ, os.Getenv and os.Getwd functions.

func Mock

func Mock() Env

Mock returns an Env that provides a mock for the os package. Use this in testing.

func Os

func Os() Env

Os returns an Env that provides a direct pass-through to the os package. Use this in production.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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