2019-02-18 07:48:40 +08:00
|
|
|
#
|
|
|
|
# Test cases
|
|
|
|
#
|
|
|
|
|
2019-10-10 06:08:01 +08:00
|
|
|
from west.main import BUILTIN_COMMANDS
|
2019-02-18 07:48:40 +08:00
|
|
|
from conftest import cmd
|
|
|
|
|
2019-09-06 23:02:36 +08:00
|
|
|
def test_builtin_help_and_dash_h(west_init_tmpdir):
|
|
|
|
# Test "west help" and "west -h" are the same for built-in
|
|
|
|
# functionality.
|
2019-02-18 07:48:40 +08:00
|
|
|
|
|
|
|
h1out = cmd('help')
|
|
|
|
h2out = cmd('-h')
|
2019-09-06 22:59:13 +08:00
|
|
|
assert h1out == h2out
|
2019-02-18 07:48:40 +08:00
|
|
|
|
2019-10-10 06:08:01 +08:00
|
|
|
for c in BUILTIN_COMMANDS.keys():
|
2019-02-18 07:48:40 +08:00
|
|
|
h1out = cmd('help {}'.format(c))
|
|
|
|
h2out = cmd('{} -h'.format(c))
|
2019-09-06 22:59:13 +08:00
|
|
|
assert h1out == h2out
|
2019-09-06 23:02:36 +08:00
|
|
|
|
|
|
|
def test_extension_help_and_dash_h(west_init_tmpdir):
|
|
|
|
# Test "west help <command>" and "west <command> -h" for extension
|
|
|
|
# commands (west_init_tmpdir has a command with one).
|
|
|
|
|
|
|
|
cmd('update')
|
|
|
|
ext1out = cmd('help test-extension')
|
|
|
|
ext2out = cmd('test-extension -h')
|
|
|
|
assert ext1out == ext2out
|
|
|
|
assert ext1out == EXTENSION_EXPECTED
|
|
|
|
|
|
|
|
|
|
|
|
EXTENSION_EXPECTED = '''\
|
|
|
|
usage: west test-extension [-h]
|
|
|
|
|
|
|
|
optional arguments:
|
|
|
|
-h, --help show this help message and exit
|
|
|
|
'''
|