1010import pytest
1111
1212import cmd2
13- from cmd2 .parsing import StatementParser
1413from cmd2 import utils
14+ from cmd2 .constants import MULTILINE_TERMINATOR
15+ from cmd2 .parsing import StatementParser
16+
1517
1618@pytest .fixture
1719def parser ():
@@ -147,6 +149,7 @@ def test_parse_word_plus_terminator(parser, line, terminator):
147149 assert statement .argv == ['termbare' ]
148150 assert not statement .arg_list
149151 assert statement .terminator == terminator
152+ assert statement .expanded_command_line == statement .command + statement .terminator
150153
151154@pytest .mark .parametrize ('line,terminator' , [
152155 ('termbare; suffx' , ';' ),
@@ -163,6 +166,7 @@ def test_parse_suffix_after_terminator(parser, line, terminator):
163166 assert not statement .arg_list
164167 assert statement .terminator == terminator
165168 assert statement .suffix == 'suffx'
169+ assert statement .expanded_command_line == statement .command + statement .terminator + ' ' + statement .suffix
166170
167171def test_parse_command_with_args (parser ):
168172 line = 'command with args'
@@ -258,6 +262,7 @@ def test_parse_simple_pipe(parser, line):
258262 assert statement .argv == ['simple' ]
259263 assert not statement .arg_list
260264 assert statement .pipe_to == ['piped' ]
265+ assert statement .expanded_command_line == statement .command + ' | ' + ' ' .join (statement .pipe_to )
261266
262267def test_parse_double_pipe_is_not_a_pipe (parser ):
263268 line = 'double-pipe || is not a pipe'
@@ -294,6 +299,7 @@ def test_parse_redirect(parser,line, output):
294299 assert statement .args == statement
295300 assert statement .output == output
296301 assert statement .output_to == 'out.txt'
302+ assert statement .expanded_command_line == statement .command + ' ' + statement .output + ' ' + statement .output_to
297303
298304def test_parse_redirect_with_args (parser ):
299305 line = 'output into > afile.txt'
@@ -539,6 +545,7 @@ def test_parse_alias_on_multiline_command(parser):
539545 assert statement .args == statement
540546 assert statement == 'has > inside an unfinished command'
541547 assert statement .terminator == ''
548+ assert statement .expanded_command_line == statement .multiline_command + ' ' + statement + MULTILINE_TERMINATOR
542549
543550@pytest .mark .parametrize ('line,output' , [
544551 ('helpalias > out.txt' , '>' ),
0 commit comments