diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2018-10-26 12:30:42 -0400 |
---|---|---|
committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2018-10-26 12:30:42 -0400 |
commit | b8d5b9661ba125dc49751220ff1574916c1d66cd (patch) | |
tree | 2e5a3691a2012a77c4ea22847dba4f502ebff24d /tests/test_completion.py | |
parent | c7c0d1468a32af07d32d80913ac1b5ffd07364b5 (diff) | |
download | cmd2-git-b8d5b9661ba125dc49751220ff1574916c1d66cd.tar.gz |
Added more code coverage of shell_cmd_complete
Diffstat (limited to 'tests/test_completion.py')
-rw-r--r-- | tests/test_completion.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/test_completion.py b/tests/test_completion.py index eae1403d..dffb03ec 100644 --- a/tests/test_completion.py +++ b/tests/test_completion.py @@ -257,6 +257,21 @@ def test_shell_command_completion_does_path_completion_when_after_command(cmd2_a first_match = complete_tester(text, line, begidx, endidx, cmd2_app) assert first_match is not None and cmd2_app.completion_matches == [text + '.py '] +def test_shell_commmand_complete_in_path(cmd2_app, request): + test_dir = os.path.dirname(request.module.__file__) + + text = os.path.join(test_dir, 's') + line = 'shell {}'.format(text) + + endidx = len(line) + begidx = endidx - len(text) + + # Since this will look for directories and executables in the given path, + # we expect to see the scripts dir among the results + expected = os.path.join(test_dir, 'scripts' + os.path.sep) + first_match = complete_tester(text, line, begidx, endidx, cmd2_app) + assert first_match is not None and expected in cmd2_app.completion_matches + def test_path_completion_single_end(cmd2_app, request): test_dir = os.path.dirname(request.module.__file__) |