You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by rp...@apache.org on 2020/04/29 06:53:45 UTC
[groovy] 01/05: GROOVY-9519: add failing test
This is an automated email from the ASF dual-hosted git repository.
rpopma pushed a commit to branch GROOVY_3_0_X
in repository https://gitbox.apache.org/repos/asf/groovy.git
commit 4efc6b1fa84ff336ee7ed9d857840f646fb6d26a
Author: Remko Popma <re...@yahoo.com>
AuthorDate: Wed Apr 29 14:11:33 2020 +0900
GROOVY-9519: add failing test
(cherry picked from commit cf60cee2a095f40c594fe3b295660a67a1729bdb)
---
.../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 c0de44a..3be2110 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
@@ -1080,4 +1080,15 @@ Usage: groovy [-hiV] [-cp] [-pa] [-pr] [--configscript=PARAM]
assertNull(optionAccessor)
}
+ // GROOVY-9519
+ testIntOptionWithDefaultZeroShouldNotConvertToBooleanFalse() {
+ def cli = new CliBuilder()
+ cli.i(type: Integer, longOpt: 'intTest', required: false, args: 1, defaultValue: '0', 'Testing integer with default value 0')
+
+ def opts = cli.parse([]) // no args, so defaults are applied
+ assert opts
+
+ assert Integer == opts.i.getClass()
+ assert opts.i == 0
+ }
}