test(coverage): add targeted tests to raise per-package coverage gates
- internal/homesick/version: new version_test.go covers String constant and semver format validation - internal/homesick/cli: add list, generate, clone, status, diff, and git-repo helper tests; coverage raised from 62.5% to 71.2% - internal/homesick/core: new helpers_test.go covers runGit pretend, actionVerb, sayStatus, unlinkPath, linkPath, readSubdirs, matchesIgnoredDir, confirmDestroy, ExecAll edge cases, and Link/Unlink default castle wrappers; core_test.go and pull_test.go extended with New constructor and PullAll quiet-mode tests; exec_test.go extended with ExecAll no-repos-dir and error-wrap tests; coverage raised from 75.6% to 80.2%
This commit is contained in:
21
internal/homesick/version/version_test.go
Normal file
21
internal/homesick/version/version_test.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package version
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestStringConstant(t *testing.T) {
|
||||
// Test that the version constant is not empty
|
||||
assert.NotEmpty(t, String, "version.String should not be empty")
|
||||
}
|
||||
|
||||
func TestStringMatchesSemVer(t *testing.T) {
|
||||
// Test that the version string matches semantic versioning pattern (major.minor.patch)
|
||||
semverPattern := `^\d+\.\d+\.\d+$`
|
||||
matched, err := regexp.MatchString(semverPattern, String)
|
||||
assert.NoError(t, err, "regex should be valid")
|
||||
assert.True(t, matched, "version.String should match semantic versioning pattern (major.minor.patch), got: %s", String)
|
||||
}
|
||||
Reference in New Issue
Block a user