diff options
Diffstat (limited to 'tests/test_completion.py')
-rw-r--r-- | tests/test_completion.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/test_completion.py b/tests/test_completion.py index a219a904..efc32986 100644 --- a/tests/test_completion.py +++ b/tests/test_completion.py @@ -20,6 +20,12 @@ def cmd2_app(): c = cmd2.Cmd() return c +@pytest.fixture +def cs_app(): + cmd2.Cmd.case_insensitive = False + c = cmd2.Cmd() + return c + def test_cmd2_command_completion_single_end(cmd2_app): text = 'he' @@ -29,6 +35,22 @@ def test_cmd2_command_completion_single_end(cmd2_app): # It is at end of line, so extra space is present assert cmd2_app.completenames(text, line, begidx, endidx) == ['help '] +def test_cmd2_command_completion_is_case_insensitive_by_default(cmd2_app): + text = 'HE' + line = 'HE' + endidx = len(line) + begidx = endidx - len(text) + # It is at end of line, so extra space is present + assert cmd2_app.completenames(text, line, begidx, endidx) == ['help '] + +def test_cmd2_case_sensitive_command_completion(cs_app): + text = 'HE' + line = 'HE' + endidx = len(line) + begidx = endidx - len(text) + # It is at end of line, so extra space is present + assert cs_app.completenames(text, line, begidx, endidx) == [] + def test_cmd2_command_completion_single_mid(cmd2_app): text = 'he' line = 'he' |