Documentation ¶
Index ¶
- func ExpectComment(t *testing.T, identifier, comment string, file io.Reader)
- func ExpectCommentIn(t *testing.T, repo fs.FS, file, identifier, comment string)
- func ExpectFiles(t *testing.T, want, got []string)
- func ExpectFindings[Findings ~map[string][]Finding, Finding interface{ ... }](t *testing.T, want, got Findings)
- func ExpectFound[Finding interface{ ... }](t *testing.T, want, got []Finding)
- func ExpectGeneratedFiles(t *testing.T, want, got []generate.File)
- func ExpectGenerations(t *testing.T, want, got []generate.Documentation)
- func ExpectIdentifiers[Finding ~string](t *testing.T, want, got []Finding)
- 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 ExpectCommentIn ¶ added in v0.0.4
func ExpectFiles ¶ added in v0.0.4
func ExpectFindings ¶
func ExpectFindings[Findings ~map[string][]Finding, Finding interface{ GetIdentifier() string }](t *testing.T, want, got Findings)
ExpectFindings tests if two find.Findings are equal. It sorts the findings by identifier, then compares the sorted findings using go-cmp/cmp.
func ExpectFound ¶ added in v0.0.4
func ExpectGeneratedFiles ¶ added in v0.0.4
func ExpectGenerations ¶
func ExpectGenerations(t *testing.T, want, got []generate.Documentation)
ExpectGenerations compares two slices of generate.Generation and fails the test if they are not equal.
func ExpectIdentifiers ¶ added in v0.0.4
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.