testutils

package
v0.0.0-...-11046fd Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2024 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertStepNames

func AssertStepNames(t *testing.T, report *td.StepReport, expectedStepNames ...string)

AssertStepNames flattens the names of the steps in the given report, then asserts that they match the given list of strings.

func MakeTempDirMockFn

func MakeTempDirMockFn(t *testing.T, dirs ...string) func(string, string) (string, error)

MakeTempDirMockFn returns a function that can be used to mock os_steps.TempDir by setting the os_steps.TempDirContextKey context key. It takes a list of directory paths, and returns the first path on first call, then the second, and so on. If the function is called more times than the number of directories, the test fails.

func MakeZIP

func MakeZIP(t *testing.T, zipPath string, contents map[string]string)

MakeZIP creates a ZIP archive with the given contents, represented as a map from file paths to file contents.

func PopulateDir

func PopulateDir(t *testing.T, dirPath string, contents map[string]string)

PopulateDir populates a directory with the given contents, represented as a map from file paths to file contents.

Types

This section is empty.

Jump to

Keyboard shortcuts

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