feat: lib-core.crafting-test v0.1.0 — 12 TAP asserts
Test suite for lib-core.crafting v0.1.0. Covers:
1. define_recipe + list_recipes round-trip; shallow-copy isolation
(mutating the returned list does not affect the registry).
2. define_recipe missing id → Loud-Error.
3. define_recipe duplicate id → Loud-Error.
4. define_recipe empty inputs → Loud-Error.
5. get_recipe known/unknown.
6. is_known propagates ctx-identity to recipe.is_known(ctx).
7. can_craft happy-path → ok=true.
8. can_craft missing inputs → error='missing_inputs' +
missing-array with {template, needed, have}.
9. craft happy-path: consumes 2, crafts 1, container has only output.
10. craft unknown recipe → ok=false, error='unknown_recipe',
container untouched.
11. craft is_known=false → ok=false, error='unknown_recipe',
container untouched.
12. count-form: 2-of-3 reports missing={template, needed=3, have=2}.
Uses engine.test.assert with string.find for pattern matching
loud-error messages (engine.test has no assert_match helper).
Per-test isolation via crafting._test_clear_all; composition templates
are defined once at module-scope (composition has no clear-all hook).
Depends on lib-core.crafting 0.1.0, lib-core.inventory-list 0.1.0,
lib-core.composition 0.3.0 (all three direct, per non-transitive
engine resolver).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
11
manifest.lib
Normal file
11
manifest.lib
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"id": "lib-core.crafting-test",
|
||||
"role": "test",
|
||||
"version": "0.1.0",
|
||||
"api_min": "0.1",
|
||||
"deps": [
|
||||
{"id": "lib-core.crafting", "version": "0.1.0"},
|
||||
{"id": "lib-core.inventory-list", "version": "0.1.0"},
|
||||
{"id": "lib-core.composition", "version": "0.3.0"}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user