summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2017-07-13 12:35:47 -0400
committerTodd Leonhardt <todd.leonhardt@gmail.com>2017-07-13 12:35:47 -0400
commitdd9717efb9cbbd2f791057742e6f7323b317d46b (patch)
tree1262c76878a5202366fe284b734e5657723ac3cd /tests
parent30a3b66e8bc9f2fc65f5ff763841438ecda3a362 (diff)
downloadcmd2-git-dd9717efb9cbbd2f791057742e6f7323b317d46b.tar.gz
Added support for case-insensitive tab-completion of cmd2 command names
Diffstat (limited to 'tests')
-rw-r--r--tests/test_completion.py22
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'