3 mutations tested. 2 caught, 1 uncaught. Gap M3: dispatch-swap in was_action_released undetectable headless (no real events). Future-Slice B candidate. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
43 lines
2.3 KiB
Markdown
43 lines
2.3 KiB
Markdown
# sporel-lib-core.input-test
|
|
|
|
P.3.3 test-lib — validates `lib-core.input` v0.4.0 API contracts (BIND_MAP,
|
|
`was_action_released`, engine mouse-surface) via the `engine.test.*` assertion surface.
|
|
17 assertions total.
|
|
|
|
- Lib-ID: `lib-core.input-test`
|
|
- Version: `0.1.0`
|
|
- Kind: `test-lib` (headless; M.run_tests(ctx) invoked by engine test-runner)
|
|
- Spec: `meta/docs/superpowers/specs/2026-05-12-p3-3-mouse-input-design.md`
|
|
|
|
## Run
|
|
|
|
```bash
|
|
Sporel.exe --libs-dir=<libs-path> --test-libs=lib-core.input-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 | `function M.was_action_released` renamed to `M._was_action_released_disabled` (API-break) | Runtime error "attempt to call a nil value (field 'was_action_released')" — test aborts after assertion 14 |
|
|
| M2 | `if not entries then return false end` changed to `return nil` (wrong return type for unknown action) | Assertion "was_action_released for unknown action returns false" (ok 16) — `not ok`, got nil |
|
|
|
|
### Uncaught Mutations (Gaps)
|
|
|
|
| # | Mutation | Why uncaught | Severity |
|
|
|---|---|---|---|
|
|
| M3 | Dispatch-swap in `was_action_released` for-loop: key-kind entries call `was_mouse_released`, mouse-kind call `was_released` | Headless mode: all input queries return false regardless of correct vs swapped dispatch — no real events to differentiate the paths | Med |
|
|
|
|
**Resolution per Gap:**
|
|
- Gap M3: Headless-unreachable — requires real key/mouse events to distinguish `was_released` from `was_mouse_released`. Future-Slice B: integration test with simulated input events. No cheap headless fill possible.
|
|
|
|
### Tested Production-Lib Surface
|
|
|
|
`lib-core.input` v0.4.0 — Tests cover behavior of: `input.bind` (mouse-string acceptance, mixed key+mouse, unknown-name rejection, atomicity), `input.action_count`, `input.is_action_down`, `input.was_action_pressed`, `input.was_action_released` (bound action headless=false; unknown action=false). Engine surface assertions: `MOUSE_LEFT/RIGHT/MIDDLE` constants, `is_mouse_down`, `was_mouse_pressed`, `was_released`, `was_mouse_released` function presence.
|