Skip to content

test: improve coverage of changelog, semver, cfg and vcs core logic#8

Merged
outofcoffee merged 1 commit into
mainfrom
worktree-improve-coverage
Jun 22, 2026
Merged

test: improve coverage of changelog, semver, cfg and vcs core logic#8
outofcoffee merged 1 commit into
mainfrom
worktree-improve-coverage

Conversation

@outofcoffee

Copy link
Copy Markdown
Collaborator

Add targeted tests for previously untested core logic across the changelog, semver, cfg and vcs packages.

Summary

  • Cover NoChangesError.Error across all four message branches
  • Add changelog read error paths (missing version, no version sections, non-existent file) and the last-section-to-end-of-file boundary
  • Test cfg.LoadConfig directory wrapper and its missing-file behaviour
  • Verify semver.GetCurrentVersion strips the v prefix and sets the prefix flag
  • Cover vcs.CheckBranch matching-branch and invalid-repo paths
  • Add an end-to-end changelog.InitChangelog test asserting written content matches disk

Implementation details

The vcs package caches the earliest/latest tag in package-level variables that other packages cannot reset, so the new semver test performs a single repository lookup to avoid cross-test contamination, and CheckBranch resolves the repo's actual current branch rather than hard-coding master/main. The last-section read test deliberately includes a trailing empty line, mirroring how ReadFile splits a file ending in a newline — readChanges relies on that to bound the final section. All tests pass under -shuffle=on.

Add focused tests for previously untested core behaviour:
- NoChangesError.Error across all message branches
- changelog read error paths and last-section boundary
- cfg.LoadConfig directory wrapper and missing-file handling
- semver.GetCurrentVersion v-prefix stripping
- vcs.CheckBranch matching-branch and invalid-repo paths
- changelog.InitChangelog end-to-end write

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@outofcoffee outofcoffee marked this pull request as ready for review June 22, 2026 16:39
@outofcoffee outofcoffee merged commit c26b51e into main Jun 22, 2026
1 check passed
@outofcoffee outofcoffee deleted the worktree-improve-coverage branch June 22, 2026 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant