Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/CONTENT_GRAMMAR_CONTRACTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ The active server is authoritative for the accepted legacy grammar:
- `atrinik/server:src/loaders/object.l#get_ob_diff` defines object serialization.
- `atrinik/server:src/server/map.c#new_save_map` defines map serialization.

`grammar-inventory.json` captures those source locations, 282 known object
`grammar-inventory.json` captures those source locations, 285 known object
fields, the map-header fields and tiled-map key pattern, object and header
delimiters, all four object scanner entry modes, both map-header scanner entry
modes, the three observable load flags, byte/line-ending behavior, and the
Expand Down
14 changes: 14 additions & 0 deletions tools/tests/test_content_contracts.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import io
import json
from pathlib import Path
import re
import shutil
import tempfile
import unittest
Expand Down Expand Up @@ -81,6 +82,19 @@ def test_grammar_inventory_is_complete_and_canonical(self):
{entry["name"] for entry in self.grammar["load_modes"]},
)

def test_grammar_documentation_reports_authoritative_field_count(self):
documentation = (ROOT / "docs" / "CONTENT_GRAMMAR_CONTRACTS.md").read_text()
match = re.search(
r"captures those source locations, ([0-9]+) known object\s+fields,",
documentation,
)

self.assertIsNotNone(match)
self.assertEqual(
len(self.grammar["object_grammar"]["known_fields"]),
int(match.group(1)),
)

def test_consumer_inventory_covers_every_legacy_role_and_repository(self):
inventory = load_json(CONTRACT_ROOT / "consumer-inventory.json")
entries = inventory["consumers"]
Expand Down