mirror of
https://github.com/clap-rs/clap
synced 2024-12-13 22:32:33 +00:00
fix(tests): fix testing script bug and formatting
This commit is contained in:
parent
3834433c20
commit
d8f03a55c4
1 changed files with 8 additions and 8 deletions
|
@ -11,24 +11,24 @@ cmds = {'help short: ': ['{} -h | wc -l'.format(_bin), ['21']],
|
||||||
'flag short: ': ['{} -f'.format(_bin), ['flag present 1 times',
|
'flag short: ': ['{} -f'.format(_bin), ['flag present 1 times',
|
||||||
'option NOT present',
|
'option NOT present',
|
||||||
'positional NOT present',
|
'positional NOT present',
|
||||||
'subcmd NOT present']],
|
'subcmd NOT present']],
|
||||||
'flags short: ': ['{} -ff'.format(_bin), ['flag present 2 times',
|
'flags short: ': ['{} -ff'.format(_bin), ['flag present 2 times',
|
||||||
'option NOT present',
|
'option NOT present',
|
||||||
'positional NOT present',
|
'positional NOT present',
|
||||||
'subcmd NOT present']],
|
'subcmd NOT present']],
|
||||||
'flags short: ': ['{} -f -f'.format(_bin), ['flag present 2 times',
|
'flags short: ': ['{} -f -f'.format(_bin), ['flag present 2 times',
|
||||||
'option NOT present',
|
'option NOT present',
|
||||||
'positional NOT present',
|
'positional NOT present',
|
||||||
'subcmd NOT present']],
|
'subcmd NOT present']],
|
||||||
'flag long: ': ['{} --flag'.format(_bin), ['flag present 1 times',
|
'flag long: ': ['{} --flag'.format(_bin), ['flag present 1 times',
|
||||||
'option NOT present',
|
'option NOT present',
|
||||||
'positional NOT present',
|
'positional NOT present',
|
||||||
'subcmd NOT present']],
|
'subcmd NOT present']],
|
||||||
'flags long: ': ['{} --flag --flag'.format(_bin), ['flag present 2 times',
|
'flags long: ': ['{} --flag --flag'.format(_bin), ['flag present 2 times',
|
||||||
'option NOT present',
|
'option NOT present',
|
||||||
'positional NOT present',
|
'positional NOT present',
|
||||||
'subcmd NOT present']],
|
'subcmd NOT present']],
|
||||||
'flags both: ': ['{} -f --flag'.format(_bin), ['flag present 2 times',
|
'flags both: ': ['{} -f --flag'.format(_bin), ['flag present 2 times',
|
||||||
'option NOT present',
|
'option NOT present',
|
||||||
'positional NOT present',
|
'positional NOT present',
|
||||||
'subcmd NOT present']],
|
'subcmd NOT present']],
|
||||||
|
@ -68,7 +68,7 @@ cmds = {'help short: ': ['{} -h | wc -l'.format(_bin), ['21']],
|
||||||
'An option: other',
|
'An option: other',
|
||||||
'positional NOT present',
|
'positional NOT present',
|
||||||
'subcmd NOT present']],
|
'subcmd NOT present']],
|
||||||
'options 3:': ['{} --option=some --option=other -o opt'.format(_bin), ['flag NOT present',
|
'options 3: ': ['{} --option=some --option=other -o opt'.format(_bin), ['flag NOT present',
|
||||||
'option present 3 times with value: some',
|
'option present 3 times with value: some',
|
||||||
'An option: some',
|
'An option: some',
|
||||||
'An option: other',
|
'An option: other',
|
||||||
|
@ -89,16 +89,16 @@ def pass_fail(name, check, good):
|
||||||
print('Pass')
|
print('Pass')
|
||||||
return
|
return
|
||||||
failed = True
|
failed = True
|
||||||
print('Fail')
|
print('Fail\n\tShould be: {}\n\tBut is: {}'.format(good, check))
|
||||||
return
|
return
|
||||||
_failed = False
|
_failed = False
|
||||||
for i, line in enumerate(check):
|
for i, line in enumerate(check):
|
||||||
if line == good[i]:
|
if line == good[i]:
|
||||||
continue
|
continue
|
||||||
_failed = True
|
_failed = True
|
||||||
|
print('Fail\n\tShould be: {}\n\tBut is: {}'.format(good[i], line))
|
||||||
if _failed:
|
if _failed:
|
||||||
failed = True
|
failed = True
|
||||||
print('Fail')
|
|
||||||
return
|
return
|
||||||
print('Pass')
|
print('Pass')
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue