summaryrefslogtreecommitdiff
path: root/tests/test_cmd2.py
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2017-06-03 10:59:06 -0400
committerTodd Leonhardt <todd.leonhardt@gmail.com>2017-06-03 10:59:06 -0400
commitad3d32339f791faa31763fe3efb42d0be469ddef (patch)
tree8bedc45871f10cfb1973aadd15abab9d2562c902 /tests/test_cmd2.py
parenta0d829e4105cd431198feb43534adaf953b090ba (diff)
downloadcmd2-git-ad3d32339f791faa31763fe3efb42d0be469ddef.tar.gz
Removed redundant list command
The extra functionality of listing a span (slice) of history items present in the list command has been incorporated into the existing history command and the list command has been removed. Unit tests have been updated accordingly. In the process a bug was fixed that was causing a crash if and end was supplied to the span but not a start.
Diffstat (limited to 'tests/test_cmd2.py')
-rw-r--r--tests/test_cmd2.py44
1 files changed, 29 insertions, 15 deletions
diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py
index ce47ef47..7d60110e 100644
--- a/tests/test_cmd2.py
+++ b/tests/test_cmd2.py
@@ -142,48 +142,62 @@ shortcuts
""")
assert out == expected
-
-def test_base_list(base_app):
+def test_history_with_string_argument(base_app):
run_cmd(base_app, 'help')
run_cmd(base_app, 'shortcuts')
- out = run_cmd(base_app, 'list')
+ run_cmd(base_app, 'help history')
+ out = run_cmd(base_app, 'history help')
expected = normalize("""
--------------------------[2]
-shortcuts
+-------------------------[1]
+help
+-------------------------[3]
+help history
""")
assert out == expected
-def test_list_with_string_argument(base_app):
+def test_history_with_integer_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')
+ out = run_cmd(base_app, 'history 1')
expected = normalize("""
-------------------------[1]
help
--------------------------[3]
-help list
""")
assert out == expected
-def test_list_with_integer_argument(base_app):
+def test_history_with_integer_span(base_app):
run_cmd(base_app, 'help')
run_cmd(base_app, 'shortcuts')
- out = run_cmd(base_app, 'list 1')
+ run_cmd(base_app, 'help history')
+ out = run_cmd(base_app, 'history 1..2')
expected = normalize("""
-------------------------[1]
help
+-------------------------[2]
+shortcuts
""")
assert out == expected
+def test_history_with_span_start(base_app):
+ run_cmd(base_app, 'help')
+ run_cmd(base_app, 'shortcuts')
+ run_cmd(base_app, 'help history')
+ out = run_cmd(base_app, 'history 2:')
+ expected = normalize("""
+-------------------------[2]
+shortcuts
+-------------------------[3]
+help history
+""")
+ assert out == expected
-def test_list_with_integer_span(base_app):
+def test_history_with_span_end(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')
+ run_cmd(base_app, 'help history')
+ out = run_cmd(base_app, 'history :2')
expected = normalize("""
-------------------------[1]
help