summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2017-02-05 16:15:20 -0500
committerTodd Leonhardt <todd.leonhardt@gmail.com>2017-02-05 16:15:20 -0500
commitde8a706e0acf8e2acbba2732540aedf66a677a4e (patch)
tree029c393cc94ecf090e1d0840d026b36938d70a73
parent17b92d99a7f847b92f5662adb46278601e89a151 (diff)
downloadcmd2-git-de8a706e0acf8e2acbba2732540aedf66a677a4e.tar.gz
Added more unit tests for list command.
Added list tests with string, integer, and integer span arguments
-rw-r--r--tests/test_cmd2.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py
index 62f03235..55c7e13e 100644
--- a/tests/test_cmd2.py
+++ b/tests/test_cmd2.py
@@ -155,6 +155,45 @@ shortcuts
assert out == expected
+def test_list_with_string_argument(base_app):
+ run_cmd(base_app, 'help')
+ run_cmd(base_app, 'shortcuts')
+ run_cmd(base_app, 'help list')
+ out = run_cmd(base_app, 'list help')
+ expected = normalize("""
+-------------------------[1]
+help
+-------------------------[3]
+help list
+""")
+ assert out == expected
+
+
+def test_list_with_integer_argument(base_app):
+ run_cmd(base_app, 'help')
+ run_cmd(base_app, 'shortcuts')
+ out = run_cmd(base_app, 'list 1')
+ expected = normalize("""
+-------------------------[1]
+help
+""")
+ assert out == expected
+
+
+def test_list_with_integer_span(base_app):
+ run_cmd(base_app, 'help')
+ run_cmd(base_app, 'shortcuts')
+ run_cmd(base_app, 'help list')
+ out = run_cmd(base_app, 'list 1..2')
+ expected = normalize("""
+-------------------------[1]
+help
+-------------------------[2]
+shortcuts
+""")
+ assert out == expected
+
+
def test_base_cmdenvironment(base_app):
out = run_cmd(base_app, 'cmdenvironment')
expected = normalize("""