Skip to content

test: add SPM test harness covering Hotkey, ConfigFile, NudgeKind, EventStore#15

Merged
StuBehan merged 1 commit into
StackOneHQ:mainfrom
StuBehan:chore/test-harness
Apr 30, 2026
Merged

test: add SPM test harness covering Hotkey, ConfigFile, NudgeKind, EventStore#15
StuBehan merged 1 commit into
StackOneHQ:mainfrom
StuBehan:chore/test-harness

Conversation

@StuBehan

Copy link
Copy Markdown
Collaborator

Summary

Adds a swift test suite covering the panel's pure-logic surfaces. Shipping binaries are still built by swiftc directly via build.shPackage.swift exists only so the test runner has somewhere to live.

Test coverage

  • HotkeyTests — parse/encode for all modifier aliases (cmd / command, opt / alt / option, ctrl / control), named keys (space / return / tab / escape), digits, multi-modifier combos. Empty / unknown-key error paths. Round-trip encode(parse(spec)) preserves canonical form.
  • ConfigFileTests — comments, blank lines, quoted values, prefix-collision guards (STACKNUDGE_VOICE_NAME vs STACKNUDGE_VOICE), in-place replacement vs append, comment-line preservation, bool() truthy/falsy/default handling, case-insensitivity.
  • NudgeKindTests — wire-format mapping (stop / permission / unknown → other), case-sensitivity expectations.
  • EventStoreTests — append truncation at maxEvents, selection on append/remove, selectNext / selectPrevious clamping, empty-store no-op, selectedEvent derivation.

39 test cases total.

Refactor (small, surface-preserving)

ConfigFile now exposes pure parse(_:) and apply(_:key:value:) helpers; read() / write(_:_:) are thin disk wrappers. No call-site changes — every caller still uses read() / write() / bool() / path.

Build / CI

  • Package.swift declares one library target pointing at panel/ + shared/ in place — no source-tree restructuring. The build.sh swiftc path keeps working in parallel.
  • .github/workflows/ci.yml gains a test-macos job that runs swift test on macos-15 (Xcode preinstalled).
  • Makefile gets make test; prints a friendly Xcode-required message when XCTest isn't reachable (Command Line Tools-only installs).
  • .gitignore covers .build/ and Package.resolved.
  • CONTRIBUTING.md documents the local Xcode requirement.

Misc

Default voice changed from af_heart to af_aoede across Speaker.swift, PanelNav.swift, notify.sh, notify.conf.example.

Test plan

  • swift build (Package.swift) succeeds
  • make build (swiftc path) still produces a working arm64 binary
  • shellcheck -S warning and bash -n clean on every tracked .sh
  • plutil -lint clean on both Info.plists
  • swift test runs green in CI (the new test-macos job)

🤖 Generated with Claude Code

…entStore

The shipping binaries are still built by swiftc directly via build.sh.
Package.swift exists only so `swift test` can run a unit-test suite over
the testable parts of the panel — the apps don't depend on it.

Test coverage
- HotkeyTests — parse/encode for all modifier aliases, named keys, digits;
  empty / unknown-key error paths; multi-modifier combos; round-trip
  encode(parse(spec)) preserves canonical form
- ConfigFileTests — comments, blank lines, quoted values, prefix-collision
  guards (STACKNUDGE_VOICE_NAME vs STACKNUDGE_VOICE), in-place replacement
  vs append, comment-line preservation, bool() truthy/falsy/default
- NudgeKindTests — wire-format mapping, unknown-fallback semantics
- EventStoreTests — append truncation at maxEvents, selection on
  append/remove, selectNext/Prev clamping, empty-store no-op

Refactor
- ConfigFile now exposes pure `parse(_:)` and `apply(_:key:value:)` helpers;
  read()/write() are thin disk wrappers. No call-site changes — every
  caller still uses read()/write()/bool()/path

Build / CI
- Package.swift declares one library target pointing at panel/ + shared/
  with the existing layout (no source-tree restructuring). The build/
  swiftc path keeps working in parallel
- .github/workflows/ci.yml gains a `test-macos` job that runs `swift test`
  on macos-15 (Xcode preinstalled)
- Makefile gets `make test`; prints a friendly Xcode-required message when
  XCTest isn't reachable (Command Line Tools-only installs)
- .gitignore covers .build/ and Package.resolved
- CONTRIBUTING.md documents the Xcode requirement for local testing

Misc
- Default voice changed from af_heart to af_aoede across Speaker.swift,
  PanelNav.swift, notify.sh, notify.conf.example

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@StuBehan StuBehan merged commit a037e27 into StackOneHQ:main Apr 30, 2026
4 checks passed
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