diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2018-03-19 12:59:17 -0400 |
---|---|---|
committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2018-03-19 12:59:17 -0400 |
commit | 44c38e351a7799b93beda23fa95e37305cfd2535 (patch) | |
tree | cd4fbdb0388afb5a8e6a048311cfb42185d1c0bb | |
parent | 07af2eeaf45b558d5c9ccfbc7008df0c67f8d333 (diff) | |
download | cmd2-git-44c38e351a7799b93beda23fa95e37305cfd2535.tar.gz |
Added unit tests for completions with quotes
-rw-r--r-- | tests/test_completion.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/test_completion.py b/tests/test_completion.py index 95487641..a7a90941 100644 --- a/tests/test_completion.py +++ b/tests/test_completion.py @@ -208,6 +208,19 @@ def test_shell_command_completion(cmd2_app): begidx = endidx - len(text) assert cmd2_app.complete_shell(text, line, begidx, endidx) == expected +def test_shell_command_completion_quotes(cmd2_app): + if sys.platform == "win32": + text = 'calc' + expected = ['calc.exe" '] + else: + text = 'egr' + expected = ['egrep" '] + + line = 'shell "{}'.format(text) + endidx = len(line) + begidx = endidx - len(text) + assert cmd2_app.complete_shell(text, line, begidx, endidx) == expected + def test_shell_command_completion_doesnt_match_wildcards(cmd2_app): if sys.platform == "win32": text = 'c*' @@ -274,6 +287,18 @@ def test_path_completion_single_end(request): assert path_complete(text, line, begidx, endidx) == ['conftest.py '] +def test_path_completion_quotes(request): + test_dir = '"' + os.path.dirname(request.module.__file__) + + text = 'c' + path = os.path.join(test_dir, text) + line = 'shell cat {}'.format(path) + + endidx = len(line) + begidx = endidx - len(text) + + assert path_complete(text, line, begidx, endidx) == ['conftest.py" '] + def test_path_completion_single_mid(request): test_dir = os.path.dirname(request.module.__file__) |