Skip to content

Add comprehensive unit tests + CI#2

Merged
cloudmanic merged 1 commit into
mainfrom
feat/comprehensive-tests
Apr 30, 2026
Merged

Add comprehensive unit tests + CI#2
cloudmanic merged 1 commit into
mainfrom
feat/comprehensive-tests

Conversation

@cloudmanic

Copy link
Copy Markdown
Owner

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%

Package Coverage Tests
internal/theme 100.0% 2
internal/filetree 96.2% 19
internal/editor 95.1% 67 (buffer 100%, tab ~98%, highlight ~76%)
internal/app 77.1% 93 (50 app + 35 modals + 8 pre-existing fileops)
internal/clipboard 30.0% 3 (limited by /dev/tty in CI)
internal/version [no stmts] 3 (semver shape locked)

Plumbing

  • Makefile — new test (with -race), test-short, and coverage targets. 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 every 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).
  • 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)
  • handleAutoScroll mid-drag (needs a live drag plus an autoScrollEvent)
  • clipboard.CopyToSystem end-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

  • CI run is green on this PR (Linux + macOS)
  • make test locally — green, no flakes
  • make coverage locally — opens coverage.html and shows the per-file numbers above
  • go test -race ./... — no race detector findings
  • Spot-check a few new test files for the doc-comment style described in CLAUDE.md

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.
@cloudmanic cloudmanic merged commit e00cee2 into main Apr 30, 2026
2 checks passed
@cloudmanic cloudmanic deleted the feat/comprehensive-tests branch April 30, 2026 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant