summaryrefslogtreecommitdiff
path: root/tests/test_cmd2.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_cmd2.py')
-rw-r--r--tests/test_cmd2.py20
1 files changed, 19 insertions, 1 deletions
diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py
index e2a3d854..0f1c5ab9 100644
--- a/tests/test_cmd2.py
+++ b/tests/test_cmd2.py
@@ -73,7 +73,7 @@ def test_base_invalid_option(base_app, capsys):
out = normalize(out)
err = normalize(err)
assert 'Error: unrecognized arguments: -z' in err[0]
- assert out[0] == 'Usage: set settable{0..2} [-h] [-a] [-l]'
+ assert out[0] == 'Usage: set [param] [value] [-h] [-a] [-l]'
def test_base_shortcuts(base_app):
out = run_cmd(base_app, 'shortcuts')
@@ -1795,6 +1795,24 @@ def test_create_invalid_alias(base_app, alias_name, capsys):
out, err = capsys.readouterr()
assert "can not contain" in err
+def test_complete_unalias(base_app):
+ text = 'f'
+ line = text
+ endidx = len(line)
+ begidx = endidx - len(text)
+
+ # Validate there are no completions when there are no aliases
+ assert base_app.complete_unalias(text, line, begidx, endidx) == []
+
+ # Create a few aliases - two the start with 'f' and one that doesn't
+ run_cmd(base_app, 'alias fall quit')
+ run_cmd(base_app, 'alias fake pyscript')
+ run_cmd(base_app, 'alias carapace shell')
+
+ # Validate that there are now completions
+ expected = ['fake', 'fall']
+ assert base_app.complete_unalias(text, line, begidx, endidx) == expected
+
def test_ppaged(base_app):
msg = 'testing...'
end = '\n'