diff options
| author | historia <[not public]> | 2026-09-19 03:15:59 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-09-19 03:15:59 -0400 |
| commit | 0e60567a7a0addb9421769ee7be7853bfa8788cb (patch) | |
| tree | 7645112db0e4eae95b8a83c1e4f9aab38bede655 /internal/game/render_help_test.go | |
| parent | cc33072eced3d5460512c09c42ec4531c807d7af (diff) | |
| download | thehouseoficarus-0e60567a7a0addb9421769ee7be7853bfa8788cb.tar.gz | |
refactor: simplifcation, change how rooms are stored in player yaml, remove legacy code
Diffstat (limited to 'internal/game/render_help_test.go')
| -rw-r--r-- | internal/game/render_help_test.go | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/internal/game/render_help_test.go b/internal/game/render_help_test.go index b8ad614..dcfa619 100644 --- a/internal/game/render_help_test.go +++ b/internal/game/render_help_test.go @@ -79,3 +79,34 @@ func TestHelpAliasesResolveWithoutCollision(t *testing.T) { } } } + +// Every verb advertised in the help table must actually be a command. "farm" +// was listed for a long time while not existing, so typing it returned +// "Unknown command." A help entry is the first thing a new player trusts. +func TestHelpCommandListMatchesRegistry(t *testing.T) { + for _, entry := range commandList { + for _, verb := range strings.Split(entry.Name, "/") { + verb = strings.TrimSpace(verb) + if verb == "" { + continue + } + if _, ok := commandRegistry[verb]; ok { + continue + } + if _, ok := verbAliases[verb]; ok { + continue + } + t.Errorf("help lists %q (from %q) but it is not a registered command", verb, entry.Name) + } + } +} + +// alwaysAvailable is a second hand-maintained verb list; it must not drift +// from the registry either. +func TestAlwaysAvailableCommandsAreRegistered(t *testing.T) { + for _, verb := range alwaysAvailable { + if _, ok := commandRegistry[verb]; !ok { + t.Errorf("alwaysAvailable lists %q but it is not registered", verb) + } + } +} |
