aboutsummaryrefslogtreecommitdiffhomepage
path: root/third_party/java/jopt-simple/src/test/java/joptsimple/examples/LongOptionsWithArgumentPositioningTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/java/jopt-simple/src/test/java/joptsimple/examples/LongOptionsWithArgumentPositioningTest.java')
-rw-r--r--third_party/java/jopt-simple/src/test/java/joptsimple/examples/LongOptionsWithArgumentPositioningTest.java26
1 files changed, 26 insertions, 0 deletions
diff --git a/third_party/java/jopt-simple/src/test/java/joptsimple/examples/LongOptionsWithArgumentPositioningTest.java b/third_party/java/jopt-simple/src/test/java/joptsimple/examples/LongOptionsWithArgumentPositioningTest.java
new file mode 100644
index 0000000000..1cf018b867
--- /dev/null
+++ b/third_party/java/jopt-simple/src/test/java/joptsimple/examples/LongOptionsWithArgumentPositioningTest.java
@@ -0,0 +1,26 @@
+package joptsimple.examples;
+
+import joptsimple.OptionParser;
+import joptsimple.OptionSet;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+public class LongOptionsWithArgumentPositioningTest {
+ @Test
+ public void allowsDifferentFormsOfPairingArgumentWithOption() {
+ OptionParser parser = new OptionParser();
+ parser.accepts( "count" ).withRequiredArg();
+ parser.accepts( "level" ).withOptionalArg();
+
+ OptionSet options = parser.parse( "--count", "4", "--level=3" );
+
+ assertTrue( options.has( "count" ) );
+ assertTrue( options.hasArgument( "count" ) );
+ assertEquals( "4", options.valueOf( "count" ) );
+
+ assertTrue( options.has( "level" ) );
+ assertTrue( options.hasArgument( "level" ) );
+ assertEquals( "3", options.valueOf( "level" ) );
+ }
+}