2019-02-07 18:10:34 +00:00
|
|
|
After:
|
|
|
|
unlet! b:parse_result
|
|
|
|
|
|
|
|
if exists(':ParseTest')
|
|
|
|
delcommand ParseTest
|
|
|
|
endif
|
|
|
|
|
|
|
|
Execute(ale#args#Parse should work for an example command):
|
|
|
|
command! -nargs=* ParseTest let b:parse_result = ale#args#Parse(['foo', 'bar'], <q-args>)
|
|
|
|
|
|
|
|
ParseTest
|
|
|
|
AssertEqual [{}, ''], b:parse_result
|
|
|
|
|
2023-09-08 00:00:35 +00:00
|
|
|
ParseTest --
|
|
|
|
AssertEqual [{}, ''], b:parse_result
|
|
|
|
|
2019-02-07 18:10:34 +00:00
|
|
|
ParseTest -foo
|
|
|
|
AssertEqual [{'foo': ''}, ''], b:parse_result
|
|
|
|
|
2023-09-08 00:00:35 +00:00
|
|
|
ParseTest -foo -- --
|
|
|
|
AssertEqual [{'foo': ''}, '--'], b:parse_result
|
|
|
|
|
2019-02-07 18:10:34 +00:00
|
|
|
ParseTest -foo -bar
|
|
|
|
AssertEqual [{'foo': '', 'bar': ''}, ''], b:parse_result
|
|
|
|
|
|
|
|
ParseTest -foo -bar leave these alone
|
|
|
|
AssertEqual [{'foo': '', 'bar': ''}, 'leave these alone'], b:parse_result
|
2023-09-08 00:00:35 +00:00
|
|
|
|
|
|
|
Execute(ale#args#Parse should raise errors for unknown arguments):
|
|
|
|
AssertThrows call ale#args#Parse(['foo', 'bar'], '-nope leave these alone')
|
|
|
|
AssertEqual 'Invalid argument: -nope', g:vader_exception
|