Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Git ¶
Git provides utilities for verifying the state of a Git repository in test cases. It can check the current branch, ensure a branch name has a specific prefix, and assert that the latest commit message matches an expected value. These assertions are intended to be used within testing functions, where they provide helpful error messages upon failure to aid in diagnosing issues with repository state during test execution.
func (Git) AssertBranch ¶
AssertBranch confirms that the current git branch matches the specified branch name using the provided *testing.T. If the current branch does not match, it calls *testing.T's Fatal method to immediately fail the test with an appropriate error message.
func (Git) AssertBranchPrefix ¶
AssertBranchPrefix verifies that the current branch name starts with the specified prefix, failing the test if it does not. It logs a fatal error with the testing.T if the current branch's name does not match the expected prefix. This function is intended to be used in test cases to ensure that branch naming conventions are followed.
func (Git) AssertCommit ¶
AssertCommit verifies that the most recent commit in the repository has the expected message. It compares the actual commit message with the provided commit object and reports an error to the testing context if they do not match. This method is intended to be used in test cases to ensure that operations affecting the repository's commit history behave as expected.
func (Git) Cmd ¶
Cmd runs a git command with the provided arguments and returns the command along with its output and any encountered error. It wraps the execution of a git command in a way that can be easily used for testing purposes, capturing both the standard output and potential errors for assertions.