summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Van Brunt <kmvanbrunt@gmail.com>2018-03-19 00:42:27 -0400
committerKevin Van Brunt <kmvanbrunt@gmail.com>2018-03-19 00:42:27 -0400
commit6b95022fa30d5f5d9ceb2ac5e35bab2c4c4096fd (patch)
tree4633a10e650e16ec991cfa92b69ba75082c2f027
parent413b04f1b5b678a7da988a9a87a8c759de199c9a (diff)
downloadcmd2-git-6b95022fa30d5f5d9ceb2ac5e35bab2c4c4096fd.tar.gz
Added unit tests for new completers
-rw-r--r--tests/test_completion.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/test_completion.py b/tests/test_completion.py
index 5e6aa13d..210296db 100644
--- a/tests/test_completion.py
+++ b/tests/test_completion.py
@@ -678,6 +678,35 @@ def test_parseline_expands_shortcuts(cmd2_app):
assert line.replace('!', 'shell ') == out_line
+# Test command completer functions to extend testing coverage
+def test_edit_completer(cmd2_app):
+ text = ''
+ line = 'edit '
+ endidx = len(line)
+ begidx = endidx - len(text)
+
+ # Verify there are results
+ assert cmd2_app.complete_edit(text, line, begidx, endidx)
+
+def test_load_completer(cmd2_app):
+ text = ''
+ line = 'load '
+ endidx = len(line)
+ begidx = endidx - len(text)
+
+ # Verify there are results
+ assert cmd2_app.complete_load(text, line, begidx, endidx)
+
+def test_pyscript_completer(cmd2_app):
+ text = ''
+ line = 'pyscript '
+ endidx = len(line)
+ begidx = endidx - len(text)
+
+ # Verify there are results
+ assert cmd2_app.complete_pyscript(text, line, begidx, endidx)
+
+
class SubcommandsExample(cmd2.Cmd):
""" Example cmd2 application where we a base command which has a couple subcommands."""