Skip to content

[chore] Cover presentation helpers printWorktreeResult / printSyncDryRun #273

Description

@lugassawan

Product framing

Impact: S · Effort: S · Tier: 1 · Good first issue

Two pure presentation helpers have uncovered branches that are easy to reach by calling the function directly with a bytes.Buffer:

  • printWorktreeResult (cmd/add.go:186) — the Copied/Skipped/SkippedSymlinks branches at L191-198 are untested (function sits at 75% branch coverage).
  • printSyncDryRun (cmd/sync.go:270) — the merge-verb branch at L272-273 is untested (83.3%).

Neither function has side effects beyond writing to an io.Writer, making them ideal unit-test targets.


Type

  • Tests (coverage gaps, e2e, fixtures)

Files to change

  • cmd/add_test.go (or a new cmd/add_print_test.go)
  • cmd/sync_test.go

Description

Current state:

  • cmd/add.go:191-198 — Copied/Skipped/SkippedSymlinks output paths in printWorktreeResult have no direct test.
  • cmd/sync.go:272-273 — the merge-verb branch in printSyncDryRun has no direct test.

Desired state: Unit tests call each function with a bytes.Buffer as the writer and assert the rendered output for each uncovered branch.

Acceptance

  • printWorktreeResult tested for Copied, Skipped, and SkippedSymlinks result types.
  • printSyncDryRun tested for the merge-verb branch.
  • Tests use bytes.Buffer — no subprocess / CLI invocation needed.
  • Branch coverage for both functions reaches 100%.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions