Add unittests for partial command parsing
This commit is contained in:
parent
c9d85d3a12
commit
520572321a
@ -146,6 +146,8 @@ def _generate_cmdline_tests():
|
||||
# Command with no_cmd_split combined with an "invalid" command -> valid
|
||||
for item in itertools.product(['bind x open'], separators, invalid):
|
||||
yield TestCase(''.join(item), True)
|
||||
# Partial command
|
||||
yield TestCase('message-i', False)
|
||||
|
||||
|
||||
@pytest.fixture(params=_generate_cmdline_tests(), ids=lambda e: e.cmd)
|
||||
|
@ -51,3 +51,12 @@ class TestCommandRunner:
|
||||
assert result.count == 20
|
||||
assert result.args == ['down']
|
||||
assert result.cmdline == ['scroll', 'down']
|
||||
|
||||
def test_partial_parsing(self):
|
||||
"""Test partial parsing with a runner where it's enabled.
|
||||
|
||||
The same with it being disabled is tested by test_parse_all.
|
||||
"""
|
||||
cr = runners.CommandRunner(0, partial_match=True)
|
||||
result = cr.parse('message-i', aliases=False)
|
||||
assert result.cmd.name == 'message-info'
|
||||
|
Loading…
Reference in New Issue
Block a user