summaryrefslogtreecommitdiff
path: root/tests/test_arguments.py
diff options
context:
space:
mode:
authorArmin Ronacher <armin.ronacher@active-4.com>2014-05-23 17:43:14 +0200
committerArmin Ronacher <armin.ronacher@active-4.com>2014-05-23 17:43:14 +0200
commita1f69d097278b158fb8748fe63a287de6ff23886 (patch)
treec9a9db90e5e0e5261c634848540546d98681b7ee /tests/test_arguments.py
parent63344698788bc75ca8630418d35ac1f3193b00e4 (diff)
downloadclick-a1f69d097278b158fb8748fe63a287de6ff23886.tar.gz
Added test for "--"
Diffstat (limited to 'tests/test_arguments.py')
-rw-r--r--tests/test_arguments.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/test_arguments.py b/tests/test_arguments.py
index 13d1c25..6afcfab 100644
--- a/tests/test_arguments.py
+++ b/tests/test_arguments.py
@@ -91,3 +91,27 @@ def test_nargs_envvar(runner):
result = runner.invoke(cmd, [], env={'X': 'foo bar'})
assert not result.exception
assert result.output == 'foo|bar\n'
+
+
+def test_eat_options(runner):
+ @click.command()
+ @click.option('-f')
+ @click.argument('files', nargs=-1)
+ def cmd(f, files):
+ for filename in files:
+ click.echo(filename)
+ click.echo(f)
+
+ result = runner.invoke(cmd, ['--', '-foo', 'bar'])
+ assert result.output.splitlines() == [
+ '-foo',
+ 'bar',
+ '',
+ ]
+
+ result = runner.invoke(cmd, ['-f', '-x', '--', '-foo', 'bar'])
+ assert result.output.splitlines() == [
+ '-foo',
+ 'bar',
+ '-x',
+ ]