You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2020/04/30 11:36:51 UTC

[groovy] branch master updated: GROOVY-9528: add test

This is an automated email from the ASF dual-hosted git repository.

paulk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git


The following commit(s) were added to refs/heads/master by this push:
     new ef0823a  GROOVY-9528: add test
ef0823a is described below

commit ef0823a09d31f8effe71bd44e032b8ca5ef26293
Author: Paul King <pa...@asert.com.au>
AuthorDate: Thu Apr 30 21:35:30 2020 +1000

    GROOVY-9528: add test
---
 .../src/test/groovy/groovy/cli/picocli/CliBuilderTest.groovy  | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/subprojects/groovy-cli-picocli/src/test/groovy/groovy/cli/picocli/CliBuilderTest.groovy b/subprojects/groovy-cli-picocli/src/test/groovy/groovy/cli/picocli/CliBuilderTest.groovy
index b1adab8..1840b4c 100644
--- a/subprojects/groovy-cli-picocli/src/test/groovy/groovy/cli/picocli/CliBuilderTest.groovy
+++ b/subprojects/groovy-cli-picocli/src/test/groovy/groovy/cli/picocli/CliBuilderTest.groovy
@@ -558,6 +558,17 @@ class CliBuilderTest extends GroovyTestCase {
         assert options.arguments() == ['foo']
     }
 
+    // GROOVY-9528
+    void testRequiredParamsWithUnknownArgumentLikeParams() {
+        def cli = new CliBuilder()
+        cli.parser.stopAtPositional(false)
+        cli.parser.unmatchedOptionsArePositionalParams(true)
+        cli.a(type: String, longOpt: 'optA', required: true, args: 1, 'Option a (required)')
+        cli.c(type: String, longOpt: 'optC', required: true, args: 1, 'Option c (required)')
+        def opts = cli.parse('-a A -b B -c C'.split(' '))
+        assert opts.arguments() == ['-b', 'B']
+    }
+
     interface PersonI {
         @Option String first()
         @Option String last()