Skip to content

Add capturing log writer test and expose LogSource (#9)#35

Merged
itsniper merged 1 commit into
masterfrom
9-automated-testing
Jun 30, 2026
Merged

Add capturing log writer test and expose LogSource (#9)#35
itsniper merged 1 commit into
masterfrom
9-automated-testing

Conversation

@itsniper

Copy link
Copy Markdown
Member

Salvages the still-useful parts of the stale `9-automated-testing` branch (rebased onto latest `master`) and drops what the current harness already supersedes.

Relates to #9 (NFR 2 — Automated Testing). Opening against the closed parent issue per request to track this follow-on testing work.

What changed

  • Expose `LogSource` — re-export `Willow.LogSource` as a `public typealias` in `LogWriters.swift`. The public `LogWriter.writeMessage(_:logLevel:logSource:)` surface already exposes `LogSource` in its signature, so consumers implementing a custom writer previously had to `import Willow` just to name the type. This matches the sibling re-exports (`LogModifier`, `LogWriter`, etc.).
  • Add a capturing-writer test — new `CapturingLogWriter` test helper plus `capturingWriterRecordsForwardedMessagesAndLevels`, which asserts on the exact messages and levels `LoggingService` forwards to its writers (and that disabling halts forwarding). This closes the gap where existing logging tests exercised the code paths for coverage but never verified emitted output at the writer boundary.
  • Drop `LoggingServiceMock.swift` — the original branch added a `LoggingService` subclass + mock writer that was never wired to any assertion and is superseded by the established harness pattern.

Verification

  • `swift test` — 28/28 pass locally from a plain terminal (headless), ~0.78s.
  • Final diff vs `master`: `LogWriters.swift` (+3) and `ReliaBLEManagerTests.swift` (+64); no production/library behavior change.

🤖 Generated with Claude Code

Re-export Willow.LogSource as a public typealias so consumers
implementing the public LogWriter surface can name the type without
importing Willow directly, matching the sibling re-exports.

Add a CapturingLogWriter test helper and a test that asserts on the
exact messages and levels LoggingService forwards to its writers,
closing the gap where logging tests exercised the code paths but never
verified emitted output at the writer boundary.

Drop the unused LoggingServiceMock subclass scaffolding in favor of the
established harness pattern.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@itsniper itsniper linked an issue Jun 30, 2026 that may be closed by this pull request
3 tasks
@itsniper itsniper merged commit e652234 into master Jun 30, 2026
1 check passed
@itsniper itsniper deleted the 9-automated-testing branch June 30, 2026 01:45
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.

NFR 2: Automated Testing

1 participant