diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2018-03-18 15:10:39 -0400 |
---|---|---|
committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2018-03-18 15:10:39 -0400 |
commit | 78073c4128f31a9ba7ff66f554898be7b1e5c932 (patch) | |
tree | d842253159895452bdab348e57988a4b6480f1cb /tests/test_completion.py | |
parent | b55f5980326f81e1009efc902bc476fa00770955 (diff) | |
download | cmd2-git-78073c4128f31a9ba7ff66f554898be7b1e5c932.tar.gz |
Merging in tests
Diffstat (limited to 'tests/test_completion.py')
-rw-r--r-- | tests/test_completion.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/tests/test_completion.py b/tests/test_completion.py index 8b7a2d14..28e3fe50 100644 --- a/tests/test_completion.py +++ b/tests/test_completion.py @@ -382,6 +382,15 @@ def test_path_completion_doesnt_match_wildcards(request): # Currently path completion doesn't accept wildcards, so will always return empty results assert path_complete(text, line, begidx, endidx) == [] +def test_path_completion_invalid_syntax(): + # Test a missing separator between a ~ and path + text = '' + line = 'shell fake ~Desktop' + endidx = len(line) + begidx = endidx - len(text) + + assert path_complete(text, line, begidx, endidx) == [] + def test_path_completion_just_tilde(): # Run path with just a tilde text = '' @@ -403,14 +412,14 @@ def test_path_completion_user_expansion(): line = 'shell {} ~{}'.format(cmd, os.path.sep) endidx = len(line) - begidx = endidx + begidx = endidx - len(text) completions_tilde_slash = path_complete(text, line, begidx, endidx) # Run path complete on the user's home directory user_dir = os.path.expanduser('~') + os.path.sep line = 'shell {} {}'.format(cmd, user_dir) endidx = len(line) - begidx = endidx + begidx = endidx - len(text) completions_home = path_complete(text, line, begidx, endidx) # Verify that the results are the same in both cases |