diff options
author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2019-03-04 22:48:33 -0500 |
---|---|---|
committer | Todd Leonhardt <todd.leonhardt@gmail.com> | 2019-03-04 22:48:33 -0500 |
commit | d1a970bc5853aa6c1c52db923fb9b4d12ada7cf2 (patch) | |
tree | 0f664834a86d6543287cf89ace609f3c0b3ae535 /tests/test_parsing.py | |
parent | f765be2ce360cf104999f1440f1b13e75cbd957c (diff) | |
parent | dddf5d03c6aa9d7a4f6e953fe1529fa3d7743e39 (diff) | |
download | cmd2-git-d1a970bc5853aa6c1c52db923fb9b4d12ada7cf2.tar.gz |
Merged master into this branch and resolved conflicts in CHANGELOG
Diffstat (limited to 'tests/test_parsing.py')
-rw-r--r-- | tests/test_parsing.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/test_parsing.py b/tests/test_parsing.py index de49d3f5..85ee0765 100644 --- a/tests/test_parsing.py +++ b/tests/test_parsing.py @@ -10,8 +10,9 @@ import attr import pytest import cmd2 -from cmd2.parsing import StatementParser from cmd2 import constants, utils +from cmd2.constants import MULTILINE_TERMINATOR +from cmd2.parsing import StatementParser @pytest.fixture def parser(): @@ -147,6 +148,7 @@ def test_parse_word_plus_terminator(parser, line, terminator): assert statement.argv == ['termbare'] assert not statement.arg_list assert statement.terminator == terminator + assert statement.expanded_command_line == statement.command + statement.terminator @pytest.mark.parametrize('line,terminator', [ ('termbare; suffx', ';'), @@ -163,6 +165,7 @@ def test_parse_suffix_after_terminator(parser, line, terminator): assert not statement.arg_list assert statement.terminator == terminator assert statement.suffix == 'suffx' + assert statement.expanded_command_line == statement.command + statement.terminator + ' ' + statement.suffix def test_parse_command_with_args(parser): line = 'command with args' @@ -222,6 +225,7 @@ def test_parse_simple_pipe(parser, line): assert statement.argv == ['simple'] assert not statement.arg_list assert statement.pipe_to == ['piped'] + assert statement.expanded_command_line == statement.command + ' | ' + ' '.join(statement.pipe_to) def test_parse_double_pipe_is_not_a_pipe(parser): line = 'double-pipe || is not a pipe' @@ -258,6 +262,7 @@ def test_parse_redirect(parser,line, output): assert statement.args == statement assert statement.output == output assert statement.output_to == 'out.txt' + assert statement.expanded_command_line == statement.command + ' ' + statement.output + ' ' + statement.output_to def test_parse_redirect_with_args(parser): line = 'output into > afile.txt' @@ -479,6 +484,7 @@ def test_parse_alias_on_multiline_command(parser): assert statement.args == statement assert statement == 'has > inside an unfinished command' assert statement.terminator == '' + assert statement.expanded_command_line == statement.multiline_command + ' ' + statement + MULTILINE_TERMINATOR @pytest.mark.parametrize('line,output', [ ('helpalias > out.txt', '>'), |