@@ -142,6 +142,20 @@ def test_parse_c_comment_empty(parser):
142142 assert not statement .pipe_to
143143 assert not statement .argv
144144
145+ def test_parse_c_comment_no_closing (parser ):
146+ statement = parser .parse ('cat /tmp/*.txt' )
147+ assert statement .command == 'cat'
148+ assert statement .args == '/tmp/*.txt'
149+ assert not statement .pipe_to
150+ assert statement .argv == ['cat' , '/tmp/*.txt' ]
151+
152+ def test_parse_c_comment_multiple_opening (parser ):
153+ statement = parser .parse ('cat /tmp/*.txt /tmp/*.cfg' )
154+ assert statement .command == 'cat'
155+ assert statement .args == '/tmp/*.txt /tmp/*.cfg'
156+ assert not statement .pipe_to
157+ assert statement .argv == ['cat' , '/tmp/*.txt' , '/tmp/*.cfg' ]
158+
145159def test_parse_what_if_quoted_strings_seem_to_start_comments (parser ):
146160 statement = parser .parse ('what if "quoted strings /* seem to " start comments?' )
147161 assert statement .command == 'what'
@@ -292,13 +306,13 @@ def test_parse_multiline_command_ignores_redirectors_within_it(parser, line, ter
292306def test_parse_multiline_with_incomplete_comment (parser ):
293307 """A terminator within a comment will be ignored and won't terminate a multiline command.
294308 Un-closed comments effectively comment out everything after the start."""
295- line = 'multiline command /* with comment in progress ;'
309+ line = 'multiline command /* with unclosed comment ;'
296310 statement = parser .parse (line )
297311 assert statement .multiline_command == 'multiline'
298312 assert statement .command == 'multiline'
299- assert statement .args == 'command'
300- assert statement .argv == ['multiline' , 'command' ]
301- assert not statement .terminator
313+ assert statement .args == 'command /* with unclosed comment '
314+ assert statement .argv == ['multiline' , 'command' , '/*' , 'with' , 'unclosed' , 'comment' ]
315+ assert statement .terminator == ';'
302316
303317def test_parse_multiline_with_complete_comment (parser ):
304318 line = 'multiline command /* with comment complete */ is done;'
0 commit comments