@Test public void singleLongOption() { OptionSet options = parser.parse("--verbose"); assertTrue(options.has("verbose")); assertEquals(emptyList(), options.valuesOf("verbose")); assertEquals(emptyList(), options.nonOptionArguments()); }
@Test public void shortOptionsInDifferentOrder() { OptionSet options = parser.parse("-fxo"); assertFalse(options.has("fox")); assertTrue(options.has("f")); assertFalse(options.has("o")); assertTrue(options.has("x")); assertEquals(singletonList("o"), options.valuesOf("x")); }
@Test public void resolvesToShortOptionsWithArgumentFollowingX() { OptionSet options = parser.parse("-foxbar"); assertFalse(options.has("fox")); assertTrue(options.has("f")); assertTrue(options.has("o")); assertTrue(options.has("x")); assertEquals(singletonList("bar"), options.valuesOf("x")); }
@Test public void abbreviationIsALegalOption() { OptionSet options = parser.parse("--verb"); assertFalse(options.has("verbose")); assertTrue(options.has("verb")); assertEquals(emptyList(), options.valuesOf("verb")); assertEquals(emptyList(), options.nonOptionArguments()); }
@Test public void abbreviation() { OptionSet options = parser.parse("--W", "silent"); assertOptionDetected(options, "Wally"); assertOptionNotDetected(options, "W"); assertEquals(singletonList("silent"), options.valuesOf("Wally")); assertEquals(emptyList(), options.nonOptionArguments()); }
@Test public void wExtensionWithLongOptionWithoutAnArgument() { OptionSet options = parser.parse("-W", "silent"); assertOptionNotDetected(options, "W"); assertOptionDetected(options, "silent"); assertEquals(emptyList(), options.valuesOf("silent")); assertEquals(emptyList(), options.nonOptionArguments()); }