Calic ccaed2d0de test: lib-core.crafting-test v0.2.0 — Locale-API assertions + bw-compat regression
Adds 6 new TAP assertions (13-18) covering the new Multi-Source /
Single-Sink locale API and the bare-handle bw-compat shim:

 13. Bw-Compat: craft(recipe, entity_handle, ctx) still accepts a
     bare container-entity-handle; post-state matches the v0.1
     single-container behavior (inputs consumed, output added back
     to the same container).
 14. Form-2 happy-path: sources={c1,c2}, sink=c1, recipe needs one
     rock + one stick (c1 has rock, c2 has stick) → c1 ends with the
     rock_pick + zero rocks, c2 ends empty.
 15. Greedy-drain-order: source1 has 2 rocks, source2 has 5 rocks,
     recipe needs 3 rocks → source1 fully drained, source2 has 4 left
     (proves left-to-right priority is stable).
 16. Aggregate missing-count: source1 has 1 rock, source2 has 1 rock,
     recipe needs 3 → can_craft returns missing entry with have=2
     (proves cross-source counting in can_craft).
 17. Loud-Error empty sources: locale={sources={}, sink=c1} →
     error string mentions "crafting", "sources", "non-empty".
 18. Loud-Error nil sink: locale={sources={c1}, sink=nil} →
     error string mentions "crafting", "sink", "nil".

Adds a sibling fixture helper `extra_container(items)` that creates
a populated container WITHOUT resetting the recipe registry. Needed
for the multi-source cases (14-18): the existing `setup_container`
calls `crafting._test_clear_all()` on every invocation, so it can
only be used once per test; the second-and-later containers come
from `extra_container`. This keeps test isolation per-case while
allowing N>1 containers in a single case.

Manifest bumped 0.1.0 → 0.2.0; dep on lib-core.crafting bumped to
0.2.0 to match the producer. inventory-list 0.1.0 and composition
0.3.0 deps unchanged.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-14 18:48:18 +02:00

lib-core.crafting-test

Test suite for lib-core.crafting v0.1.0.

12 assertions.

Run:

SPOREL_LIBS_DIR=~/Projects/Sporel/sporel-libs SPOREL_CI=1 SPOREL_LOG_STDERR=1 \
  ./build/Sporel.exe --test-libs=lib-core.crafting-test 2>&1 | tail -30
Description
No description provided
Readme 40 KiB
Languages
Lua 100%