Files
WoW-Hybrid-gateway/tests/octo_slash_coverage_test.py

30 lines
2.0 KiB
Python

"""#150: every Octo 1.12 slash command (Octo FrameXML SLASH_* + Octo modules) must exist in Forever: natively
(70334 GlobalStrings SLASH_* rows), in a shipped Octo client addon, or on the DEFERRED list with its reason.
Commands whose native meaning differs from Octo's are listed in DIFFERENT and must stay justified."""
import re
from pathlib import Path
R = Path(__file__).resolve().parents[1]
native = set((R / 'tests/data/slash/native-70334.txt').read_text().split())
octo = dict(l.split() for l in (R / 'tests/data/slash/octo-112.txt').read_text().splitlines())
addon = set()
for f in (R / 'client_addons').glob('*/*.lua'):
addon |= {m.lower() for m in re.findall(r'"(/[A-Za-z0-9]+)"', f.read_text(errors='replace'))
if re.search(r'SLASH_|add\(', f.read_text(errors='replace'))}
# Commands baked into client FrameXML by content generators (e.g. the native Store: /shop, /donateshop).
for f in (R / 'ops/native_source_store.py',):
addon |= {m.lower() for m in re.findall(r'SLASH_[A-Z_]+\d="(/[A-Za-z0-9]+)"', f.read_text(errors='replace'))}
DEFERRED = {
'/aio': 'Rochet2 AIO debug command; the Turtle server has no AIO handler',
}
DIFFERENT = { # Octo meaning -> native meaning kept
'/bg': 'BATTLEGROUND chat = native INSTANCE_CHAT', '/battleground': 'same as /bg',
'/w': 'SMART_WHISPER is the native whisper', '/t': 'same', '/tell': 'same', '/whisper': 'same', '/send': 'same',
}
# Owner 2026-11-27: /h and /i work as on Octo. The native rows (SLASH_HELP1 "/h", SLASH_INSTANCE_CHAT1 "/i") are renamed
# by the GlobalStrings content step and OctoSlash owns the Octo meaning.
TAKEN_OVER = {'/h': 'HARDCORE', '/i': 'INVITE'}
assert all(c in addon and octo.get(c) == k for c, k in TAKEN_OVER.items()), 'OctoSlash must provide /h and /i'
missing = sorted(c for c in octo if c not in native and c not in addon and c not in DEFERRED)
assert not missing, f'Octo slash commands without a Forever command: {missing}'
print(f'octo slash coverage PASS: {len(octo)} commands, {len(DEFERRED)} deferred, {len(DIFFERENT)} with native meaning')