Skip to content

Commit

Permalink
issue pallets#393: Add more tests to support changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
rsiemens committed Apr 15, 2016
1 parent 2cae5e9 commit ee780c3
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions tests/test_formatting.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,41 @@ def foo(bar):
click.echo('foo:' + bar)

result = runner.invoke(cmd, ['foo'])
assert result.exit_code == 2
assert result.output.splitlines() == [
'Usage: cmd foo [OPTIONS] BAR',
'Try "cmd foo --help" for help.',
'',
'Error: Missing argument "bar".'
]


def test_formatting_usage_error_no_help(runner):
@click.command(add_help_option=False)
@click.argument('arg')
def cmd(arg):
click.echo('arg:' + arg)

result = runner.invoke(cmd, [])
assert result.exit_code == 2
assert result.output.splitlines() == [
'Usage: cmd [OPTIONS] ARG',
'',
'Error: Missing argument "arg".'
]


def test_formatting_usage_custom_help(runner):
@click.command(context_settings=dict(help_option_names=['--man']))
@click.argument('arg')
def cmd(arg):
click.echo('arg:' + arg)

result = runner.invoke(cmd, [])
assert result.exit_code == 2
assert result.output.splitlines() == [
'Usage: cmd [OPTIONS] ARG',
'Try "cmd --man" for help.',
'',
'Error: Missing argument "arg".'
]

0 comments on commit ee780c3

Please sign in to comment.