diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2018-03-18 22:31:59 -0400 |
---|---|---|
committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2018-03-18 22:31:59 -0400 |
commit | 51b9056e5edfe3419873562948739dee339cf888 (patch) | |
tree | 07c87d19394b4bd36b421a86ebd913c4230f6a4b /tests/test_completion.py | |
parent | 1c59c1586718d005ba0087d4cec8eb79e60a9e66 (diff) | |
download | cmd2-git-51b9056e5edfe3419873562948739dee339cf888.tar.gz |
Updated remaining completion functions to handle spaces within quotes
Diffstat (limited to 'tests/test_completion.py')
-rw-r--r-- | tests/test_completion.py | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/tests/test_completion.py b/tests/test_completion.py index 28e3fe50..5e6aa13d 100644 --- a/tests/test_completion.py +++ b/tests/test_completion.py @@ -482,9 +482,9 @@ def test_basic_completion_single_end(): def test_basic_completion_single_mid(): text = 'Pi' - line = 'list_food -f Pi' - begidx = len(line) - len(text) - endidx = begidx + 1 + line = 'list_food -f Piz' + begidx = len(line) - 3 + endidx = begidx + len(text) assert basic_complete(text, line, begidx, endidx, food_item_strs) == ['Pizza'] @@ -515,9 +515,9 @@ def test_flag_based_completion_single_end(): def test_flag_based_completion_single_mid(): text = 'Pi' - line = 'list_food -f Pi' - begidx = len(line) - len(text) - endidx = begidx + 1 + line = 'list_food -f Piz' + begidx = len(line) - 3 + endidx = begidx + len(text) assert flag_based_complete(text, line, begidx, endidx, flag_dict) == ['Pizza'] @@ -567,7 +567,7 @@ def test_flag_based_completion_quotes(): endidx = len(line) begidx = endidx - len(text) - assert flag_based_complete(text, line, begidx, endidx, flag_dict) == ['Pizza'] + assert flag_based_complete(text, line, begidx, endidx, flag_dict) == ['Pizza" '] def test_flag_based_completion_no_tokens(): text = '' @@ -595,10 +595,10 @@ def test_index_based_completion_single_end(): assert index_based_complete(text, line, begidx, endidx, index_dict) == ['Football '] def test_index_based_completion_single_mid(): - text = 'Foo' + text = 'Fo' line = 'command Pizza Foo' - begidx = len(line) - len(text) - endidx = begidx + 1 + begidx = len(line) - 3 + endidx = begidx + len(text) assert index_based_complete(text, line, begidx, endidx, index_dict) == ['Football'] @@ -646,7 +646,7 @@ def test_index_based_completion_quotes(): endidx = len(line) begidx = endidx - len(text) - assert index_based_complete(text, line, begidx, endidx, index_dict) == ['Pizza'] + assert index_based_complete(text, line, begidx, endidx, index_dict) == ["Pizza' "] def test_parseline_command_and_args(cmd2_app): |