# sporel-module-lib-core.command-test P.3.7 reference test-module — validates `lib-core.command` API contracts via the `engine.test.*` assertion surface. - Module-ID: `lib-core.command-test` - Version: `0.1.0` - Kind: `test-module` (headless; runs init() once + exits) - Spec: `meta/docs/superpowers/specs/2026-05-14-p3-7-lib-command-design.md` ## Run ```bash Sporel.exe --test-libs=lib-core.command-test ``` Output is TAP version 13 on stdout; exit-code = failure-count (0 = all pass). ## Coverage Statements (2026-05-16 Fault-Injection Audit) Verified via deliberate-mutation in fixture-mirror; mutations reverted after observation. ### Caught Mutations | # | Mutation | Caught by | |---|---|---| | M1 | `M.move_to` prefixed with `do return end` (complete no-op) | 6 assertions fail: "current returns move-command data" (ok 4), "is_moving true after move_to" (ok 5), "update moves 10px" (ok 9), "arrival snap to target.x" (ok 11), "cancel doesn't affect h3" (ok 14), "move_to with unknown handle errors" (ok 23) | | M2 | `M.is_moving` prefixed with `do return false end` (always false) | Assertion "is_moving true after move_to" (ok 5) | ### Uncaught Mutations (Gaps) | # | Mutation | Why uncaught | Severity | |---|---|---|---| | M3 | `M.cancel_all` rewritten to loop-and-break after first entry (only cancels one command) | Existing test cancels h2 manually before calling `cancel_all`, leaving only h3 active — single-entry cancel_all succeeds trivially | Medium | **Resolution per Gap:** - Gap M3: Cheap-fill applied — added a second `cancel_all` scenario where both h2 and h3 are active simultaneously; asserts both are nil after `cancel_all` (commit see below). ### Cheap-Gap-Fills Applied | Gap | New Assertion | Re-Inject Verifies | |---|---|---| | M3 | `cancel_all clears h2 of 2-unit batch` — `current(h2) == nil` after issuing move to both then cancel_all | ✓ | | M3 | `cancel_all clears h3 of 2-unit batch` — `current(h3) == nil` after same cancel_all | ✓ | ### Tested Production-Lib Surface `lib-core.command` v0.1.0 — Tests cover: `register`, `unregister`, `count_registered`, `move_to`, `current`, `is_moving`, `cancel`, `cancel_all`, `speed`, `set_speed`, `arrive_threshold`, `set_arrive_threshold`, `enabled`, `set_enabled`, `update` (step + arrival-snap).