Repository navigation
Add unit tests for modules/mercurial (0% -> 72.3% coverage) - #2128
Merged
Seanstoppable merged 2 commits intoJul 26, 2026
Merged
Seanstoppable merged 2 commits into
Seanstoppable merged 2 commits into
Conversation
- 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
hginstall/repo (formatting, parsing, settings, and exec-arg construction via a fakehgscript 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 fakehgscript on PATH (100%)settings.go- YAML settings parsing,ConfigTextwidget.go-currentData(),mercurialRepos(),Refresh(),Pull()Not covered: modal/UI wiring (
Checkout()'s form construction) - exercising it deadlocked in tview'sSetFocuswithout a running event loop, so it was left out rather than adding a flaky/hanging test.