Add comprehensive unit tests + CI#2
Merged
Merged
Conversation
Brings the project up from one test file to nine, covering every
source file. Total statement coverage is 81.8% — driven by four
parallel testing agents, each scoped to a different package.
Per-package coverage:
internal/theme 100.0% 2 tests
internal/filetree 96.2% 19 tests
internal/editor 95.1% 67 tests (buffer 100%, tab ~98%, highlight ~76%)
internal/app 77.1% 93 tests (50 app + 35 modals + 8 fileops)
internal/clipboard 30.0% 3 tests (limited by /dev/tty in CI)
internal/version [no stmts] 3 tests (semver shape locked)
Plumbing changes:
* Makefile gains 'test' (-race), 'test-short', and 'coverage'
(writes coverage.out + a browsable coverage.html). 'clean'
nukes the coverage artifacts too.
* .github/workflows/test.yml runs go test -race ./... on Linux
+ macOS for every push and PR. Vets, verifies go.mod is tidy,
builds, tests, and uploads the coverage profile as an artifact.
* .gitignore adds /coverage.out and /coverage.html.
* CLAUDE.md replaces the one-line 'Tests' section with the full
bar: every source file gets a _test.go in the same package,
bug fixes need a regression test, t.Skip is reserved for hard
environment limits (e.g. /dev/tty in CI). Documents 'make
test' and 'make coverage'.
* README.md notes the new make targets and that CI runs tests
on every push / PR.
The TUI's interactive bits (Run loop, real screen init, the
auto-scroll goroutine, mid-drag reconcile) remain uncovered — they
need a live terminal. Everything else is exercised through
tcell.SimulationScreen + t.TempDir.
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.
Summary
Brings the project from one test file to nine, covering every source file. Driven by four parallel testing agents, one per package group.
Total statement coverage: 81.8%
internal/themeinternal/filetreeinternal/editorinternal/appinternal/clipboard/dev/ttyin CI)internal/versionPlumbing
test(with-race),test-short, andcoveragetargets.coveragewritescoverage.out+ a browsablecoverage.html.cleannukes the coverage artifacts too..github/workflows/test.yml— runsgo test -race ./...on Linux + macOS for every push and every PR. Vets, verifiesgo.modis tidy, builds, tests, and uploads the coverage profile as an artifact..gitignore— adds/coverage.outand/coverage.html.CLAUDE.md— replaces the one-line "Tests" section with the full bar: every source file gets a_test.goin the same package, bug fixes need a regression test,t.Skipis reserved for hard environment limits (e.g./dev/tty).README.md— notes the new make targets and that CI runs tests on every push / PR.What's not covered
The TUI's interactive bits stay untested:
App.New/App.Run(real terminal screen + goroutine wiring)startTreeRefresh/reconcileOpenTabsWithDisk(only fires on the background tick)handleAutoScrollmid-drag (needs a live drag plus anautoScrollEvent)clipboard.CopyToSystemend-to-end on machines without/dev/tty(the encoding contract is still locked down via a byte-mirror test)These are the "test from the TUI manually" paths the architecture explicitly carves out. Everything else is exercised via
tcell.SimulationScreen+t.TempDir.Test plan
make testlocally — green, no flakesmake coveragelocally — openscoverage.htmland shows the per-file numbers abovego test -race ./...— no race detector findings