Help us shape the future of Go! Take the 2026 Go Developer Survey

ios

package module
v0.0.0-...-31ebd5f Latest Latest
Warning

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

Go to latest
Published: May 10, 2021 License: MIT Imports: 2 Imported by: 8

README

Build Status Coverage

problem statement

native os package exposed via interface

features

  • API compatible w/ native os package exposed via interface
  • fake implementation to allow faking interactions

Be advised: this project is currently at Major version zero. Per the semantic versioning spec: "Major version zero (0.y.z) is for initial development. Anything may change at any time. The public API should not be considered stable."

Releases

for every release:

Versioning

This project adheres to the Semantic Versioning specification

Contributing

see CONTRIBUTING.md

Changelog

see CHANGELOG.md

Documentation

Overview

Code generated by counterfeiter. DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fake

type Fake struct {
	ChmodStub func(name string, mode os.FileMode) error

	CreateStub func(name string) (*os.File, error)

	ExitStub func(code int)

	FindProcessStub func(pid int) (*os.Process, error)

	GetenvStub func(key string) string

	GetpidStub func() int

	GetwdStub func() (string, error)

	MkdirAllStub func(path string, perm os.FileMode) error

	OpenStub func(name string) (*os.File, error)

	OpenFileStub func(name string, flag int, perm os.FileMode) (*os.File, error)

	RemoveAllStub func(path string) error

	SetenvStub func(key, value string) error

	StatStub func(name string) (os.FileInfo, error)
	// contains filtered or unexported fields
}

func (*Fake) Chmod

func (fake *Fake) Chmod(name string, mode os.FileMode) error

func (*Fake) ChmodArgsForCall

func (fake *Fake) ChmodArgsForCall(i int) (string, os.FileMode)

func (*Fake) ChmodCallCount

func (fake *Fake) ChmodCallCount() int

func (*Fake) ChmodReturns

func (fake *Fake) ChmodReturns(result1 error)

func (*Fake) ChmodReturnsOnCall

func (fake *Fake) ChmodReturnsOnCall(i int, result1 error)

func (*Fake) Create

func (fake *Fake) Create(name string) (*os.File, error)

func (*Fake) CreateArgsForCall

func (fake *Fake) CreateArgsForCall(i int) string

func (*Fake) CreateCallCount

func (fake *Fake) CreateCallCount() int

func (*Fake) CreateReturns

func (fake *Fake) CreateReturns(result1 *os.File, result2 error)

func (*Fake) CreateReturnsOnCall

func (fake *Fake) CreateReturnsOnCall(i int, result1 *os.File, result2 error)

func (*Fake) Exit

func (fake *Fake) Exit(code int)

func (*Fake) ExitArgsForCall

func (fake *Fake) ExitArgsForCall(i int) int

func (*Fake) ExitCallCount

func (fake *Fake) ExitCallCount() int

func (*Fake) FindProcess

func (fake *Fake) FindProcess(pid int) (*os.Process, error)

func (*Fake) FindProcessArgsForCall

func (fake *Fake) FindProcessArgsForCall(i int) int

func (*Fake) FindProcessCallCount

func (fake *Fake) FindProcessCallCount() int

func (*Fake) FindProcessReturns

func (fake *Fake) FindProcessReturns(result1 *os.Process, result2 error)

func (*Fake) FindProcessReturnsOnCall

func (fake *Fake) FindProcessReturnsOnCall(i int, result1 *os.Process, result2 error)

func (*Fake) Getenv

func (fake *Fake) Getenv(key string) string

func (*Fake) GetenvArgsForCall

func (fake *Fake) GetenvArgsForCall(i int) string

func (*Fake) GetenvCallCount

func (fake *Fake) GetenvCallCount() int

func (*Fake) GetenvReturns

func (fake *Fake) GetenvReturns(result1 string)

func (*Fake) GetenvReturnsOnCall

func (fake *Fake) GetenvReturnsOnCall(i int, result1 string)

func (*Fake) Getpid

func (fake *Fake) Getpid() int

func (*Fake) GetpidCallCount

func (fake *Fake) GetpidCallCount() int

func (*Fake) GetpidReturns

func (fake *Fake) GetpidReturns(result1 int)

func (*Fake) GetpidReturnsOnCall

func (fake *Fake) GetpidReturnsOnCall(i int, result1 int)

func (*Fake) Getwd

func (fake *Fake) Getwd() (string, error)

func (*Fake) GetwdCallCount

func (fake *Fake) GetwdCallCount() int

func (*Fake) GetwdReturns

func (fake *Fake) GetwdReturns(result1 string, result2 error)

func (*Fake) GetwdReturnsOnCall

func (fake *Fake) GetwdReturnsOnCall(i int, result1 string, result2 error)

func (*Fake) Invocations

func (fake *Fake) Invocations() map[string][][]interface{}

func (*Fake) MkdirAll

func (fake *Fake) MkdirAll(path string, perm os.FileMode) error

func (*Fake) MkdirAllArgsForCall

func (fake *Fake) MkdirAllArgsForCall(i int) (string, os.FileMode)

func (*Fake) MkdirAllCallCount

func (fake *Fake) MkdirAllCallCount() int

func (*Fake) MkdirAllReturns

func (fake *Fake) MkdirAllReturns(result1 error)

func (*Fake) MkdirAllReturnsOnCall

func (fake *Fake) MkdirAllReturnsOnCall(i int, result1 error)

func (*Fake) Open

func (fake *Fake) Open(name string) (*os.File, error)

func (*Fake) OpenArgsForCall

func (fake *Fake) OpenArgsForCall(i int) string

func (*Fake) OpenCallCount

func (fake *Fake) OpenCallCount() int

func (*Fake) OpenFile

func (fake *Fake) OpenFile(name string, flag int, perm os.FileMode) (*os.File, error)

func (*Fake) OpenFileArgsForCall

func (fake *Fake) OpenFileArgsForCall(i int) (string, int, os.FileMode)

func (*Fake) OpenFileCallCount

func (fake *Fake) OpenFileCallCount() int

func (*Fake) OpenFileReturns

func (fake *Fake) OpenFileReturns(result1 *os.File, result2 error)

func (*Fake) OpenFileReturnsOnCall

func (fake *Fake) OpenFileReturnsOnCall(i int, result1 *os.File, result2 error)

func (*Fake) OpenReturns

func (fake *Fake) OpenReturns(result1 *os.File, result2 error)

func (*Fake) OpenReturnsOnCall

func (fake *Fake) OpenReturnsOnCall(i int, result1 *os.File, result2 error)

func (*Fake) RemoveAll

func (fake *Fake) RemoveAll(path string) error

func (*Fake) RemoveAllArgsForCall

func (fake *Fake) RemoveAllArgsForCall(i int) string

func (*Fake) RemoveAllCallCount

func (fake *Fake) RemoveAllCallCount() int

func (*Fake) RemoveAllReturns

func (fake *Fake) RemoveAllReturns(result1 error)

func (*Fake) RemoveAllReturnsOnCall

func (fake *Fake) RemoveAllReturnsOnCall(i int, result1 error)

func (*Fake) Setenv

func (fake *Fake) Setenv(key string, value string) error

func (*Fake) SetenvArgsForCall

func (fake *Fake) SetenvArgsForCall(i int) (string, string)

func (*Fake) SetenvCallCount

func (fake *Fake) SetenvCallCount() int

func (*Fake) SetenvReturns

func (fake *Fake) SetenvReturns(result1 error)

func (*Fake) SetenvReturnsOnCall

func (fake *Fake) SetenvReturnsOnCall(i int, result1 error)

func (*Fake) Stat

func (fake *Fake) Stat(name string) (os.FileInfo, error)

func (*Fake) StatArgsForCall

func (fake *Fake) StatArgsForCall(i int) string

func (*Fake) StatCallCount

func (fake *Fake) StatCallCount() int

func (*Fake) StatReturns

func (fake *Fake) StatReturns(result1 os.FileInfo, result2 error)

func (*Fake) StatReturnsOnCall

func (fake *Fake) StatReturnsOnCall(i int, result1 os.FileInfo, result2 error)

type IOS

type IOS interface {
	// Chmod changes the mode of the named file to mode.
	// If the file is a symbolic link, it changes the mode of the link's target.
	// If there is an error, it will be of type *PathError.
	Chmod(name string, mode os.FileMode) error

	// Create creates the named file with mode 0666 (before umask), truncating
	// it if it already exists. If successful, methods on the returned
	// File can be used for I/O; the associated file descriptor has mode
	// O_RDWR.
	// If there is an error, it will be of type *PathError.
	Create(name string) (*os.File, error)

	// Exit causes the current program to exit with the given status code.
	// Conventionally, code zero indicates success, non-zero an error.
	// The program terminates immediately; deferred functions are not run.
	Exit(code int)

	// FindProcess looks for a running process by its pid.
	//
	// The Process it returns can be used to obtain information
	// about the underlying operating system process.
	//
	// On Unix systems, FindProcess always succeeds and returns a Process
	// for the given pid, regardless of whether the process exists.
	FindProcess(pid int) (*os.Process, error)

	// Getenv retrieves the value of the environment variable named by the key.
	// It returns the value, which will be empty if the variable is not present.
	Getenv(key string) string

	// Getpid returns the process id of the caller.
	Getpid() int

	// Getwd returns a rooted path name corresponding to the
	// current directory. If the current directory can be
	// reached via multiple paths (due to symbolic links),
	// Getwd may return any one of them.
	Getwd() (string, error)

	// MkdirAll creates a directory named path,
	// along with any necessary parents, and returns nil,
	// or else returns an error.
	// The permission bits perm are used for all
	// directories that MkdirAll creates.
	// If path is already a directory, MkdirAll does nothing
	// and returns nil.
	MkdirAll(path string, perm os.FileMode) error

	// Open opens the named file for reading. If successful, methods on
	// the returned file can be used for reading; the associated file
	// descriptor has mode O_RDONLY.
	// If there is an error, it will be of type *PathError.
	Open(name string) (*os.File, error)

	// OpenFile is the generalized open call; most users will use Open
	// or Create instead. It opens the named file with specified flag
	// (O_RDONLY etc.) and perm, (0666 etc.) if applicable. If successful,
	// methods on the returned File can be used for I/O.
	// If there is an error, it will be of type *PathError.
	OpenFile(name string, flag int, perm os.FileMode) (*os.File, error)

	// RemoveAll removes path and any children it contains.
	// It removes everything it can but returns the first error
	// it encounters. If the path does not exist, RemoveAll
	// returns nil (no error).
	RemoveAll(path string) error

	// Setenv sets the value of the environment variable named by the key.
	// It returns an error, if any.
	Setenv(key, value string) error

	// Stat returns a FileInfo describing the named file.
	// If there is an error, it will be of type *PathError.
	Stat(name string) (os.FileInfo, error)
}

virtual operating system interface

func New

func New() IOS

Jump to

Keyboard shortcuts

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