Files
sporel-lib-core.selection-test/README.md
Axel Meyer 80688aa832 test(selection-test): cheap-fill M3 gap + Coverage Statements (Test-Cov Phase 2.5)
3 mutations tested. 2 caught, 1 uncaught (M3: add unregistered-handle guard absent).
Cheap-fill: added pcall assertions for add(unregistered) and toggle(unregistered).
2026-05-16 02:38:21 +02:00

2.0 KiB

sporel-module-lib-core.selection-test

P.3.6 reference test-module — validates lib-core.selection API contracts via the engine.test.* assertion surface.

  • Module-ID: lib-core.selection-test
  • Version: 0.1.0
  • Kind: test-module (headless; runs init() once + exits)
  • Spec: meta/docs/superpowers/specs/2026-05-14-p3-6-lib-selection-design.md

Run

Sporel.exe --test-libs=lib-core.selection-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.contains prefixed with do return false end (always false) Assertions "add → contains" (ok 6) and "toggle adds when absent" (ok 9) — 2 failures
M2 M.count prefixed with do return 0 end (always zero) Assertion "count = 1 after add" (ok 7) — expected 1 got 0

Uncaught Mutations (Gaps)

# Mutation Why uncaught Severity
M3 M.add unregistered-handle guard removed (any handle accepted silently) No test calls add(unregistered_handle) and expects an error Medium

Resolution per Gap:

  • Gap M3: Cheap-fill applied — two pcall error assertions added for add(99999) and toggle(99999) (commit see below).

Cheap-Gap-Fills Applied

Gap New Assertion Re-Inject Verifies
M3 add(unregistered) errorspcall(function() selection.add(99999) end) must return false
M3 toggle(unregistered) errorspcall(function() selection.toggle(99999) end) must return false

Tested Production-Lib Surface

lib-core.selection v0.1.0 — Tests cover: register, unregister, count_registered, is_empty, count, contains, add, remove, toggle, clear, drag_threshold, set_drag_threshold, drag_state, box_rect, enabled, set_enabled, set_drag_box_color, drag_box_color, set_highlight_color, highlight_color.