Documentation ¶
Index ¶
- Variables
- func AssertError(t *testing.T, expected string, actual error)
- func AssertSlice(t *testing.T, expected, actual []string)
- func ConfigureFakeExec(helperTest string) (CmdBuilder, EnvBuilder)
- func CreateRepo(t *testing.T) (*vcs.GitRepository, *git.Repository, billy.Filesystem, *git.Worktree)
- func DecodeYaml(source string, object any) error
- func ExecTestHandler(t *testing.T, cases map[string]func())
- func FsFromMap(t *testing.T, files map[string]string) billy.Filesystem
- func FsFromSlice(t *testing.T, files []string) billy.Filesystem
- func MakeCommits(t *testing.T, wt *git.Worktree, fs billy.Basic, ...)
- func MakeFiles(t *testing.T, fs billy.Basic, files map[string]string)
- func NopCloser(wr io.Writer) io.WriteCloser
- type CmdBuilder
- type EnvBuilder
Constants ¶
This section is empty.
Variables ¶
var TestUser = user.User{ Uid: "1", Gid: "2", Username: "evg4b", Name: "Evgeny Abramovich", HomeDir: filepath.Join("usr", "home"), }
TestUser is os/user.User stub.
Functions ¶
func AssertError ¶
AssertError error by string, where expected string is empty then error should be null. Otherwise error message should be matched to string.
func AssertSlice ¶
func ConfigureFakeExec ¶
func ConfigureFakeExec(helperTest string) (CmdBuilder, EnvBuilder)
ConfigureFakeExec configures exec.Cmd builder mock to call passed helper test (helper test should be located in the package with test).
func CreateRepo ¶
func CreateRepo(t *testing.T) (*vcs.GitRepository, *git.Repository, billy.Filesystem, *git.Worktree)
CreateRepo creates vcs.GitRepository and all dependencies.
func DecodeYaml ¶
DecodeYaml decodes object from yaml string (KnownFields = true).
func ExecTestHandler ¶
ExecTestHandler configure helper test to check executed command. Key is concatenation program with arguments e.g. 'go test ./..'.
func FsFromMap ¶
FsFromMap creates billy.Filesystem in memory from map. Where key is a filename and value is file context.
func FsFromSlice ¶
FsFromMap creates billy.Filesystem in memory from slice. Each element of slice is filename, content always "test".
func MakeCommits ¶
MakeCommits creates commits history from two-dimensional map. First level key is a commit message, second key is a file name and value is a file content.