diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2018-09-21 17:13:00 -0400 |
---|---|---|
committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2018-09-21 17:13:00 -0400 |
commit | 24c3d8d7bc9ebab4a89017389a2f79e66de4db18 (patch) | |
tree | ee9e47ba7e5e254ca5bf3480d7b331bf891fac2d /tests/test_cmd2.py | |
parent | 92dd10ec702e0cde0ee1fd157957aa816f2c137f (diff) | |
parent | dbe485957b421f6fd973b3a493de7b264b363d54 (diff) | |
download | cmd2-git-24c3d8d7bc9ebab4a89017389a2f79e66de4db18.tar.gz |
Merge branch 'master' into alert_printer
Diffstat (limited to 'tests/test_cmd2.py')
-rw-r--r-- | tests/test_cmd2.py | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py index fdf0f661..1e7e2c3f 100644 --- a/tests/test_cmd2.py +++ b/tests/test_cmd2.py @@ -72,7 +72,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') @@ -1804,6 +1804,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' |