test: add SPM test harness covering Hotkey, ConfigFile, NudgeKind, EventStore#15
Merged
Merged
Conversation
…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>
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
Adds a
swift testsuite covering the panel's pure-logic surfaces. Shipping binaries are still built byswiftcdirectly viabuild.sh—Package.swiftexists only so the test runner has somewhere to live.Test coverage
encode(parse(spec))preserves canonical form.STACKNUDGE_VOICE_NAMEvsSTACKNUDGE_VOICE), in-place replacement vs append, comment-line preservation,bool()truthy/falsy/default handling, case-insensitivity.stop/permission/ unknown →other), case-sensitivity expectations.maxEvents, selection on append/remove,selectNext/selectPreviousclamping, empty-store no-op,selectedEventderivation.39 test cases total.
Refactor (small, surface-preserving)
ConfigFilenow exposes pureparse(_:)andapply(_:key:value:)helpers;read()/write(_:_:)are thin disk wrappers. No call-site changes — every caller still usesread()/write()/bool()/path.Build / CI
Package.swiftdeclares one library target pointing atpanel/+shared/in place — no source-tree restructuring. Thebuild.shswiftc path keeps working in parallel..github/workflows/ci.ymlgains atest-macosjob that runsswift testonmacos-15(Xcode preinstalled).Makefilegetsmake test; prints a friendly Xcode-required message when XCTest isn't reachable (Command Line Tools-only installs)..gitignorecovers.build/andPackage.resolved.CONTRIBUTING.mddocuments the local Xcode requirement.Misc
Default voice changed from
af_hearttoaf_aoedeacrossSpeaker.swift,PanelNav.swift,notify.sh,notify.conf.example.Test plan
swift build(Package.swift) succeedsmake build(swiftc path) still produces a working arm64 binaryshellcheck -S warningandbash -nclean on every tracked.shplutil -lintclean on bothInfo.plistsswift testruns green in CI (the newtest-macosjob)🤖 Generated with Claude Code