summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKevin Van Brunt <kmvanbrunt@gmail.com>2019-03-17 00:06:16 -0400
committerKevin Van Brunt <kmvanbrunt@gmail.com>2019-03-17 00:06:16 -0400
commit61d95b7cb39551b2ca002c0fd2285c68a02a18a1 (patch)
tree72e6a2c905565ffcd94e250333f6549b43cb9fa1 /tests
parent28b7ec2ae2531366d41805b19700ca93677502b4 (diff)
downloadcmd2-git-61d95b7cb39551b2ca002c0fd2285c68a02a18a1.tar.gz
Added unit tests for expand flag of parse()
Diffstat (limited to 'tests')
-rw-r--r--tests/test_parsing.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/test_parsing.py b/tests/test_parsing.py
index 85ee0765..8cea3305 100644
--- a/tests/test_parsing.py
+++ b/tests/test_parsing.py
@@ -471,11 +471,18 @@ def test_empty_statement_raises_exception():
('l', 'shell', 'ls -al')
])
def test_parse_alias_and_shortcut_expansion(parser, line, command, args):
+ # Test first with expansion
statement = parser.parse(line)
assert statement.command == command
assert statement == args
assert statement.args == statement
+ # Now allow no expansion
+ statement = parser.parse(line, expand=False)
+ assert statement.command == line.split()[0]
+ assert statement.split() == line.split()[1:]
+ assert statement.args == statement
+
def test_parse_alias_on_multiline_command(parser):
line = 'anothermultiline has > inside an unfinished command'
statement = parser.parse(line)