@@ -180,6 +180,20 @@ def test_parse_c_comment_empty(parser):
180180 assert not statement .argv
181181 assert statement == ''
182182
183+ def test_parse_c_comment_no_closing (parser ):
184+ statement = parser .parse ('cat /tmp/*.txt' )
185+ assert statement .command == 'cat'
186+ assert statement .args == '/tmp/*.txt'
187+ assert not statement .pipe_to
188+ assert statement .argv == ['cat' , '/tmp/*.txt' ]
189+
190+ def test_parse_c_comment_multiple_opening (parser ):
191+ statement = parser .parse ('cat /tmp/*.txt /tmp/*.cfg' )
192+ assert statement .command == 'cat'
193+ assert statement .args == '/tmp/*.txt /tmp/*.cfg'
194+ assert not statement .pipe_to
195+ assert statement .argv == ['cat' , '/tmp/*.txt' , '/tmp/*.cfg' ]
196+
183197def test_parse_what_if_quoted_strings_seem_to_start_comments (parser ):
184198 statement = parser .parse ('what if "quoted strings /* seem to " start comments?' )
185199 assert statement .command == 'what'
@@ -344,14 +358,13 @@ def test_parse_multiline_command_ignores_redirectors_within_it(parser, line, ter
344358def test_parse_multiline_with_incomplete_comment (parser ):
345359 """A terminator within a comment will be ignored and won't terminate a multiline command.
346360 Un-closed comments effectively comment out everything after the start."""
347- line = 'multiline command /* with comment in progress ;'
361+ line = 'multiline command /* with unclosed comment ;'
348362 statement = parser .parse (line )
349363 assert statement .multiline_command == 'multiline'
350364 assert statement .command == 'multiline'
351- assert statement .args == 'command'
352- assert statement == statement .args
353- assert statement .argv == ['multiline' , 'command' ]
354- assert not statement .terminator
365+ assert statement .args == 'command /* with unclosed comment'
366+ assert statement .argv == ['multiline' , 'command' , '/*' , 'with' , 'unclosed' , 'comment' ]
367+ assert statement .terminator == ';'
355368
356369def test_parse_multiline_with_complete_comment (parser ):
357370 line = 'multiline command /* with comment complete */ is done;'
0 commit comments