Skip to content

Commit

Permalink
Added more unit tests for list command.
Browse files Browse the repository at this point in the history
Added list tests with string, integer, and integer span arguments
  • Loading branch information
tleonhardt committed Feb 5, 2017
1 parent 17b92d9 commit de8a706
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions tests/test_cmd2.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,45 @@ def test_base_list(base_app):
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("""
Expand Down

0 comments on commit de8a706

Please sign in to comment.