summaryrefslogtreecommitdiff
path: root/tests/test_cmd2.py
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2018-09-21 09:54:39 -0400
committerGitHub <noreply@github.com>2018-09-21 09:54:39 -0400
commit69b16f1631c0f808964d797d84a943c862284ab5 (patch)
treef6a9027a31537181a4b98ccb9e2967d282f14193 /tests/test_cmd2.py
parente17d0e96990e0d8215ff1f1d234c46ca7c8f01ac (diff)
parent89097505f50d295a3879b3be3eec45bcdb9d08eb (diff)
downloadcmd2-git-69b16f1631c0f808964d797d84a943c862284ab5.tar.gz
Merge branch 'master' into colorize
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'