testutil

package
v1.24.0 Latest Latest
Warning

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

Go to latest
Published: May 12, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package testutil contains functions intended only to be used during testing of ggman.

Functions in this package are not considered part of the stable interface. For this reason most functions are themselves untested.

Index

Constants

View Source
const AuthorEmail = "jane.doe@example.com"

AuthorEmail is the email to be used for email of the author of test git commit-likes.

View Source
const AuthorName = "Jane Doe"

AuthorName is the name to be used for authors of test git commit-likes.

Variables

This section is empty.

Functions

func CaseSensitive added in v1.12.0

func CaseSensitive(t *testing.T) bool

CaseSensitive checks if temporary directories exist on a case-sensitive file system.

This function is untested due to unpredictability of runtime environment.

func CommitTestFiles

func CommitTestFiles(repo *git.Repository, files map[string]string) (*git.Worktree, plumbing.Hash)

CommitTestFiles makes a new commit in the repository repo. The commit will contain files with the names and content of the contained map. When the map is nil, a default dummy file will be used instead. The commit will appear to have been authored from a bogus author and have a bogus commit message.

The function returns the worktree of the repository and the commit hash produced

The files will be written out to disk. If an error occurs, panic() is called.

func NewTestRepo

func NewTestRepo(t *testing.T) (clonePath string, repo *git.Repository)

If something goes wrong, the function calls panic().

func NewTestRepoAt

func NewTestRepoAt(clonePath, remote string) (repo *git.Repository)

The 'remote' part of this function is untested.

func ToOSPath added in v1.20.0

func ToOSPath(path string) (result string)

ToOSPath turns a path that is separated via "/"s into a path separated by the current os-separator.

When path starts with "/", the path is guaranteed to contain a volume name.

func ToOSPaths added in v1.20.0

func ToOSPaths(paths []string) []string

ToOSPaths is like ToOSPath, but applies to each value in a slice or array. ToOSPaths modifies the slice in-place and returns it for convenience.

This function is untested.

Types

This section is empty.

Jump to

Keyboard shortcuts

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