Documentation
¶
Index ¶
- func ExpectComment(t *testing.T, identifier, comment string, file io.Reader)
- func ExpectFindings(t *testing.T, want, got find.Findings)
- func ExpectGenerations(t *testing.T, want, got []generate.Generation)
- func ExpectPatch(t *testing.T, want *patch.Patch, got *patch.Patch)
- func InitRepo(name, root string) error
- func Must[T any](v T, err error) T
- func WithRepo(name string, root string, fn func(fs.FS))
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExpectComment ¶
ExpectComment verifies that the comment for the specified identifier in the provided file matches the expected comment. If the comments do not match, ExpectComment will fail the test with a detailed diff of the expected and found comments.
func ExpectFindings ¶
ExpectFindings tests if two find.Findings are equal. It sorts the findings by identifier, then compares the sorted findings using go-cmp/cmp.
func ExpectGenerations ¶
func ExpectGenerations(t *testing.T, want, got []generate.Generation)
ExpectGenerations compares two slices of generate.Generation and fails the test if they are not equal.
func ExpectPatch ¶
ExpectPatch compares two *patch.Patch structs and fails the test if their DryRun output differs.
func InitRepo ¶
InitRepo initializes a new Git repository in the given directory and populates it with files from a fixture. The name of the fixture is passed as the first argument and must match one of the available fixtures. The second argument is the path to the directory where the repository should be created.
func Must ¶
Must is a function that takes a value and an error and returns the value. If the error is not nil, Must panics with the error. It is commonly used to simplify error handling by eliminating the need to check for errors explicitly.
func WithRepo ¶
WithRepo initializes a new Git repository with test fixtures and executes a function on the created repository. The repository is created in the directory specified by root. The name parameter specifies which set of test fixtures to use. The function fn is called with an fs.FS that represents the root directory of the created repository.
Types ¶
This section is empty.