Skip to content

Commit 61d95b7

Browse files
committed
Added unit tests for expand flag of parse()
1 parent 28b7ec2 commit 61d95b7

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

tests/test_parsing.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,11 +471,18 @@ def test_empty_statement_raises_exception():
471471
('l', 'shell', 'ls -al')
472472
])
473473
def test_parse_alias_and_shortcut_expansion(parser, line, command, args):
474+
# Test first with expansion
474475
statement = parser.parse(line)
475476
assert statement.command == command
476477
assert statement == args
477478
assert statement.args == statement
478479

480+
# Now allow no expansion
481+
statement = parser.parse(line, expand=False)
482+
assert statement.command == line.split()[0]
483+
assert statement.split() == line.split()[1:]
484+
assert statement.args == statement
485+
479486
def test_parse_alias_on_multiline_command(parser):
480487
line = 'anothermultiline has > inside an unfinished command'
481488
statement = parser.parse(line)

0 commit comments

Comments
 (0)