Example #1
0
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
    tokens = shlex_split(line)
    statement = parser.parse(line, expand=False)
    assert statement.command == tokens[0]
    assert shlex_split(statement) == tokens[1:]
    assert statement.args == statement
Example #2
0
def test_parse_embedded_comment_char(parser):
    command_str = 'hi ' + constants.COMMENT_CHAR + ' not a comment'
    statement = parser.parse(command_str)
    assert statement.command == 'hi'
    assert statement == constants.COMMENT_CHAR + ' not a comment'
    assert statement.args == statement
    assert statement.argv == shlex_split(command_str)
    assert statement.arg_list == statement.argv[1:]