diff options
author | kotfu <jared@kotfu.net> | 2018-05-06 09:27:03 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-06 09:27:03 -0600 |
commit | bfdb482341efae823016ae7b1799cad06104309d (patch) | |
tree | d14932e0756fba6e5eca2c1ff0f0457622eadbbc /tests/test_cmd2.py | |
parent | 7f33f04c6f0c1f873dc1adba41bb3cc97d066a46 (diff) | |
parent | 2f102b911f1ec87d58039c9a5beca9b23a6c5474 (diff) | |
download | cmd2-git-bfdb482341efae823016ae7b1799cad06104309d.tar.gz |
Merge pull request #390 from python-cmd2/refactor_parseline
Refactor parseline()
Diffstat (limited to 'tests/test_cmd2.py')
-rw-r--r-- | tests/test_cmd2.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py index b6416005..0da7e9d5 100644 --- a/tests/test_cmd2.py +++ b/tests/test_cmd2.py @@ -1718,3 +1718,21 @@ def test_ppaged(base_app): base_app.ppaged(msg) out = base_app.stdout.buffer assert out == msg + end + +# we override cmd.parseline() so we always get consistent +# command parsing by parent methods we don't override +# don't need to test all the parsing logic here, because +# parseline just calls StatementParser.parse_command_only() +def test_parseline_empty(base_app): + statement = '' + command, args, line = base_app.parseline(statement) + assert not command + assert not args + assert not line + +def test_parseline(base_app): + statement = " command with 'partially completed quotes " + command, args, line = base_app.parseline(statement) + assert command == 'command' + assert args == "with 'partially completed quotes" + assert line == statement.strip() |