Skip to content

Add unit tests for modules/mercurial (0% -> 72.3% coverage) - #2128

Merged
Seanstoppable merged 2 commits into
wtfutil:trunkfrom
Seanstoppable:seanstoppable-symmetrical-goggles
Jul 26, 2026
Merged

Seanstoppable merged 2 commits into
wtfutil:trunkfrom
Seanstoppable:seanstoppable-symmetrical-goggles

Conversation

@Seanstoppable

Copy link
Copy Markdown
Collaborator

Coverage

modules/mercurial: 0% -> 72.3% (go test ./modules/mercurial/... -cover)

Motivation

This module had no tests, making it risky to change with confidence. Adding coverage for the parts that don't require a real hg install/repo (formatting, parsing, settings, and exec-arg construction via a fake hg script on PATH) gives a safety net for future changes.

What's tested

  • display.go - commit/change formatting, content() (100%)
  • hg_repo.go - repoPath(), bookmark(), and exec-based methods via a fake hg script on PATH (100%)
  • settings.go - YAML settings parsing, ConfigText
  • widget.go - currentData(), mercurialRepos(), Refresh(), Pull()

Not covered: modal/UI wiring (Checkout()'s form construction) - exercising it deadlocked in tview's SetFocus without a running event loop, so it was left out rather than adding a flaky/hanging test.

- display_test.go: table-driven tests for formatChange/formatChanges,
  formatCommit/formatCommits, and content() (with/without data)
- hg_repo_test.go: repoPath()/bookmark() pure logic tests, plus exec-based
  tests using a fake hg script on PATH for branch/status/log/pull/checkout
- settings_test.go: NewSettingsFromYAML defaults/custom values, ConfigText
- widget_test.go: NewWidget, currentData edge cases, mercurialRepos,
  Refresh, and Pull using the fake hg script
@Seanstoppable
Seanstoppable merged commit 9cfe962 into wtfutil:trunk Jul 26, 2026
4 checks passed
@Seanstoppable
Seanstoppable deleted the seanstoppable-symmetrical-goggles branch July 26, 2026 01:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

⌂ 换网址