Add test for alias exact match over prefix
This commit is contained in:
parent
68fa08d776
commit
8c83130f67
1 changed files with 20 additions and 0 deletions
|
|
@ -213,3 +213,23 @@ async def test_prefix_match_with_args(player, clean_registry):
|
|||
output = "".join([call[0][0] for call in player.writer.write.call_args_list])
|
||||
|
||||
assert "Handler called with args: the floor" in output
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_alias_exact_match_over_prefix_collision(player, clean_registry):
|
||||
"""Test alias exact match wins over prefix when otherwise ambiguous."""
|
||||
commands.register(
|
||||
CommandDefinition(
|
||||
name="look", aliases=["l"], handler=dummy_handler, mode="normal"
|
||||
)
|
||||
)
|
||||
commands.register(
|
||||
CommandDefinition(name="list", handler=dummy_handler, mode="normal")
|
||||
)
|
||||
|
||||
await commands.dispatch(player, "l")
|
||||
output = "".join([call[0][0] for call in player.writer.write.call_args_list])
|
||||
|
||||
# Should call handler (exact match on alias), not show ambiguous
|
||||
assert "Handler called" in output
|
||||
assert "or" not in output
|
||||
|
|
|
|||
Loading…
Reference in a new issue