diff options
author | Mike Drob <mdrob@mdrob.com> | 2013-06-07 02:33:58 -0400 |
---|---|---|
committer | Mike Drob <mdrob@mdrob.com> | 2013-06-07 02:33:58 -0400 |
commit | fa793cd8418739fba071ab481b322bdcad18389f (patch) | |
tree | d53ceb314378a1904e9fe0c28cf625e00fcdce95 | |
parent | 25fbea80c0d4e8b84143b19fb729c1b8c27989a5 (diff) | |
download | platform_external_jcommander-fa793cd8418739fba071ab481b322bdcad18389f.tar.gz platform_external_jcommander-fa793cd8418739fba071ab481b322bdcad18389f.tar.bz2 platform_external_jcommander-fa793cd8418739fba071ab481b322bdcad18389f.zip |
test to reproduce bug with quoted main parameters
-rw-r--r-- | pom.xml | 2 | ||||
-rw-r--r-- | src/test/java/com/mdrob/jcommander/QuotedMainTest.java | 26 |
2 files changed, 13 insertions, 15 deletions
@@ -131,7 +131,7 @@ <artifactId>maven-surefire-plugin</artifactId> <version>2.10</version> <configuration> - <skipTests>true</skipTests> + <skipTests>false</skipTests> </configuration> <dependencies> <dependency> diff --git a/src/test/java/com/mdrob/jcommander/QuotedMainTest.java b/src/test/java/com/mdrob/jcommander/QuotedMainTest.java index fcd2e2e..9b0cbb3 100644 --- a/src/test/java/com/mdrob/jcommander/QuotedMainTest.java +++ b/src/test/java/com/mdrob/jcommander/QuotedMainTest.java @@ -1,7 +1,6 @@ package com.mdrob.jcommander; import java.util.ArrayList; -import java.util.Collections; import java.util.List; import org.testng.Assert; @@ -10,21 +9,20 @@ import org.testng.annotations.Test; import com.beust.jcommander.JCommander; import com.beust.jcommander.Parameter; - public class QuotedMainTest { - public static class Options { - @Parameter - List<String> args = new ArrayList<String>(); - - @Parameter(names={"-f", "--foo"}) - String other; - } + @Parameter + List<String> args = new ArrayList<String>(); + String quoted = "\" \""; + @Test - public void testMain() { - String quoted = "\"quoted\""; - Options options = new Options(); - new JCommander(options).parse(quoted); - Assert.assertEquals(options.args, Collections.singletonList(quoted)); + public void testMain() { + JCommander jc = new JCommander(this); + jc.parse(quoted); + Assert.assertEquals(args.size(), 1); + } + + public static void main(String[] args) { + new QuotedMainTest().testMain(); } } |