testhelpers

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 2, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NotMockedValue notMocked = notMocked{}

Functions

func ConcatLines

func ConcatLines(lines []string) string

func PtrTo

func PtrTo[T any](val T) *T

Types

type BoolArg

type BoolArg int
const (
	False BoolArg = iota
	True
	Any
)

func (BoolArg) ToBoolList

func (b BoolArg) ToBoolList() []bool

type MockCommandExecutor

type MockCommandExecutor struct {
	mock.Mock
}

func (*MockCommandExecutor) Run

func (m *MockCommandExecutor) Run(ctx context.Context, command string, args []string, settings ...cmd.Setting) (int, error)

func (*MockCommandExecutor) RunQuiet

func (m *MockCommandExecutor) RunQuiet(ctx context.Context, command string, args ...string) (int, error)

func (*MockCommandExecutor) RunStdout

func (m *MockCommandExecutor) RunStdout(ctx context.Context, command string, args ...string) (int, error)

type MockFileSystem

type MockFileSystem struct {
	mock.Mock
}

func (*MockFileSystem) DeleteFile

func (m *MockFileSystem) DeleteFile(filename string) (bool, error)

func (*MockFileSystem) FileExists

func (m *MockFileSystem) FileExists(filename string) (bool, error)

func (*MockFileSystem) GetLocalExecutable

func (m *MockFileSystem) GetLocalExecutable(name string) (string, error)

func (*MockFileSystem) ReadDirRecursive

func (m *MockFileSystem) ReadDirRecursive(path string, depth int, strictDepth bool) ([]common.ReadDirEntry, error)

func (*MockFileSystem) ReadFileLines

func (m *MockFileSystem) ReadFileLines(filename string) ([]string, error)

func (*MockFileSystem) WriteFile

func (m *MockFileSystem) WriteFile(filename string, content []byte) error

func (*MockFileSystem) WriteLockFileFunc

func (m *MockFileSystem) WriteLockFileFunc(filename string, writeFunc func(io.Writer) error) (common.LockFile, error)

type MockGitHelper

type MockGitHelper struct {
	mock.Mock
}

func (*MockGitHelper) CloneBareRepo

func (m *MockGitHelper) CloneBareRepo(ctx context.Context, url string, destination string) error

func (*MockGitHelper) CreateBundle

func (m *MockGitHelper) CreateBundle(ctx context.Context, repoDir string, filename string) (bool, error)

func (*MockGitHelper) CreateBundleFromRefs

func (m *MockGitHelper) CreateBundleFromRefs(ctx context.Context, repoDir string, filename string, refs map[string]string) error

func (*MockGitHelper) CreateIncrementalBundle

func (m *MockGitHelper) CreateIncrementalBundle(ctx context.Context, repoDir string, filename string, prereqs []string) (bool, error)

func (*MockGitHelper) GetRemoteUrl

func (m *MockGitHelper) GetRemoteUrl(ctx context.Context, repoDir string) (string, error)

func (*MockGitHelper) UpdateBareRepo

func (m *MockGitHelper) UpdateBareRepo(ctx context.Context, repoDir string) error

type MockLockFile

type MockLockFile struct {
	mock.Mock
}

func (*MockLockFile) Commit

func (m *MockLockFile) Commit() error

func (*MockLockFile) Rollback

func (m *MockLockFile) Rollback() error

type MockTraceLogger

type MockTraceLogger struct {
	mock.Mock
}

func (*MockTraceLogger) ChildProcess

func (l *MockTraceLogger) ChildProcess(ctx context.Context, cmd *exec.Cmd) (func(error), func())

func (*MockTraceLogger) Error

func (l *MockTraceLogger) Error(ctx context.Context, err error) error

func (*MockTraceLogger) Errorf

func (l *MockTraceLogger) Errorf(ctx context.Context, format string, a ...any) error

func (*MockTraceLogger) Exit

func (l *MockTraceLogger) Exit(ctx context.Context, exitCode int)

func (*MockTraceLogger) Fatal

func (l *MockTraceLogger) Fatal(ctx context.Context, err error)

func (*MockTraceLogger) Fatalf

func (l *MockTraceLogger) Fatalf(ctx context.Context, format string, a ...any)

func (*MockTraceLogger) LogCommand

func (l *MockTraceLogger) LogCommand(ctx context.Context, commandName string) context.Context

func (*MockTraceLogger) Region

func (l *MockTraceLogger) Region(ctx context.Context, category string, label string) (context.Context, func())

type MockUserProvider

type MockUserProvider struct {
	mock.Mock
}

func (*MockUserProvider) CurrentUser

func (m *MockUserProvider) CurrentUser() (*user.User, error)

type Pair

type Pair[T any, R any] struct {
	First  T
	Second R
}

func NewPair

func NewPair[T any, R any](first T, second R) Pair[T, R]

type TestReadDirEntry

type TestReadDirEntry struct {
	PathVal  string
	NameVal  string
	IsDirVal bool
	TypeVal  fs.FileMode
	InfoVal  fs.FileInfo
}

func (TestReadDirEntry) Info

func (e TestReadDirEntry) Info() (fs.FileInfo, error)

func (TestReadDirEntry) IsDir

func (e TestReadDirEntry) IsDir() bool

func (TestReadDirEntry) Name

func (e TestReadDirEntry) Name() string

func (TestReadDirEntry) Path

func (e TestReadDirEntry) Path() string

func (TestReadDirEntry) Type

func (e TestReadDirEntry) Type() fs.FileMode

Jump to

Keyboard shortcuts

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