fix(map): load_map rejects two deployment sides bound to the same zone letter (build_states resets its placed set per side, so shared letters deployed camps on top of each other) - fail-fast MapValidationError + README rule, reject/accept tests
This commit is contained in:
@@ -109,3 +109,20 @@ def test_rejects_deployment_without_zone(tmp_path: Path) -> None:
|
||||
body = _minimal_map() + "zones: |\n ...\n .A.\n ...\ndeployment:\n players: B\n"
|
||||
with pytest.raises(MapValidationError):
|
||||
load_map(_write(tmp_path, body))
|
||||
|
||||
|
||||
def test_rejects_shared_deployment_zone_letter(tmp_path: Path) -> None:
|
||||
"""Two sides bound to the same zone letter would deploy on top of each
|
||||
other (build_states resets its placed set per side): a data error."""
|
||||
body = _minimal_map() + (
|
||||
"zones: |\n ...\n .A.\n ...\ndeployment:\n players: A\n monsters: A\n"
|
||||
)
|
||||
with pytest.raises(MapValidationError, match="share zone letters"):
|
||||
load_map(_write(tmp_path, body))
|
||||
|
||||
|
||||
def test_accepts_distinct_deployment_zone_letters(tmp_path: Path) -> None:
|
||||
body = _minimal_map() + (
|
||||
"zones: |\n ...\n AB.\n ...\ndeployment:\n players: A\n monsters: B\n"
|
||||
)
|
||||
assert load_map(_write(tmp_path, body)).deployment == {"players": "A", "monsters": "B"}
|
||||
|
||||
Reference in New Issue
Block a user