diff options
author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2019-06-13 23:41:04 -0400 |
---|---|---|
committer | Todd Leonhardt <todd.leonhardt@gmail.com> | 2019-06-13 23:41:04 -0400 |
commit | 5635962154ac670a73c7c608f56ceb146e975f3f (patch) | |
tree | 89d88d0691046b4587f0daa4686bd0370007cb78 /tests/test_parsing.py | |
parent | f64f9d559caa08b5649b9bd356af2812acf103bd (diff) | |
download | cmd2-git-5635962154ac670a73c7c608f56ceb146e975f3f.tar.gz |
Fix history display issues
Issues were two fold:
- HistoryItem statement.raw was getting mangled for multiline commands due to macro-related changes in _input_line_to_statement()
- HistoryItem pretty printing wasn't using rstrip() anymore in verbose mode
I added a couple unit tests in the process of getting here. But we should add some explicit unit tests of _input_line_to_statement() for cases like:
- basic single-line command
- macro single-line command
- multiline command
Diffstat (limited to 'tests/test_parsing.py')
-rw-r--r-- | tests/test_parsing.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/test_parsing.py b/tests/test_parsing.py index de8d67af..9b2fd25b 100644 --- a/tests/test_parsing.py +++ b/tests/test_parsing.py @@ -489,6 +489,18 @@ def test_parse_unfinished_multiliine_command(parser): assert statement.arg_list == statement.argv[1:] assert statement.terminator == '' +def test_parse_basic_multiline_command(parser): + line = 'multiline foo\nbar\n\n' + statement = parser.parse(line) + assert statement.multiline_command == 'multiline' + assert statement.command == 'multiline' + assert statement == 'foo bar' + assert statement.args == statement + assert statement.argv == ['multiline', 'foo', 'bar'] + assert statement.arg_list == ['foo', 'bar'] + assert statement.raw == line + assert statement.terminator == '\n' + @pytest.mark.parametrize('line,terminator',[ ('multiline has > inside;', ';'), ('multiline has > inside;;;', ';'), |