testutils

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertPanic

func AssertPanic(t *testing.T, f func())

func Bool

func Bool(v bool) *bool

func CreateMockServer

func CreateMockServer() *echo.Echo

func EscapeHCLString

func EscapeHCLString(s string) string

func ExecuteCommand

func ExecuteCommand(rootCommand *cobra.Command, args ...string) (c *cobra.Command, output string, err error)

func ExecuteCommandErr

func ExecuteCommandErr(rootCommand *cobra.Command, args ...string) (c *cobra.Command, output string, errOutput string, err error)

func GetOSRoot

func GetOSRoot() string

func Int

func Int(v int) *int

func String

func String(v string) *string

Types

type MockFs added in v0.1.6

type MockFs struct {
	afero.MemMapFs
}

func (*MockFs) Create added in v0.1.6

func (m *MockFs) Create(name string) (afero.File, error)

func (*MockFs) MkdirAll added in v0.1.6

func (m *MockFs) MkdirAll(path string, perm fs.FileMode) error

func (*MockFs) Open added in v0.1.6

func (m *MockFs) Open(name string) (afero.File, error)

this function gives error when opening file_does_not_exist.txt

type MockIoUtil added in v0.1.6

type MockIoUtil struct{}

func SetupMemMapFs

func SetupMemMapFs(root string) (afero.Fs, *MockIoUtil, string)

func (*MockIoUtil) Exists added in v0.1.6

func (i *MockIoUtil) Exists(afs afero.Fs, path string) (bool, error)

func (*MockIoUtil) ReadFile added in v0.1.6

func (i *MockIoUtil) ReadFile(afs afero.Fs, filename string) ([]byte, error)

func (*MockIoUtil) WriteFile added in v0.1.6

func (i *MockIoUtil) WriteFile(afs afero.Fs, filename string, data []byte, perm os.FileMode) error

Jump to

Keyboard shortcuts

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