summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Drob <mdrob@mdrob.com>2013-06-07 02:33:58 -0400
committerMike Drob <mdrob@mdrob.com>2013-06-07 02:33:58 -0400
commitfa793cd8418739fba071ab481b322bdcad18389f (patch)
treed53ceb314378a1904e9fe0c28cf625e00fcdce95
parent25fbea80c0d4e8b84143b19fb729c1b8c27989a5 (diff)
downloadplatform_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.xml2
-rw-r--r--src/test/java/com/mdrob/jcommander/QuotedMainTest.java26
2 files changed, 13 insertions, 15 deletions
diff --git a/pom.xml b/pom.xml
index d17bda8..ece970e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -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();
}
}