From b5edc05b1fcc2d1ca981f2b567461fcc5178e9f1 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sun, 11 Oct 2026 00:14:50 +0200 Subject: [PATCH] grammar-reader: pin every referent code (Person and Population arms survived mutation) The Aetheria-written fixture binds only Faction, Cargo and Place, so mutants deleting the Person and Population arms survived. The new test authors each code at the role's key and reads it back as its own kind. Builds. Co-Authored-By: Claude Opus 5.5 --- crates/ghostlight/src/aetheria/tests.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/crates/ghostlight/src/aetheria/tests.rs b/crates/ghostlight/src/aetheria/tests.rs index 748ba52..460e03a 100644 --- a/crates/ghostlight/src/aetheria/tests.rs +++ b/crates/ghostlight/src/aetheria/tests.rs @@ -353,3 +353,25 @@ fn reading_leaves_the_catalog_and_its_directory_untouched() { assert_eq!(std::fs::read(&path).unwrap(), bytes); assert_eq!(listing(dir.path()), before, "the reader created a file"); } + +#[test] +fn every_referent_code_maps_to_its_own_kind() { + // The fixture binds only Faction, Cargo and Place; Person and Population + // are authored here at the role's integer key, each read back as itself. + for (code, expected) in [ + (1, GrammarReferentKind::Person), + (2, GrammarReferentKind::Faction), + (3, GrammarReferentKind::Population), + (4, GrammarReferentKind::Place), + (5, GrammarReferentKind::Cargo), + ] { + let mut rows = fixture_rows(); + edit(&mut rows, "verb-attack", |cells| cells[3][0][2] = json!(code)); + let catalog = read(&rows).unwrap(); + assert_eq!( + catalog.grammar.verb("attack"), + Some(&verb(RenderPath::ShipAction, &[("target", expected)])), + "code {code}" + ); + } +}