@Test public void resolvesAbbreviationToLongOption() { OptionSet options = parser.parse("-fo"); assertTrue(options.has("fox")); assertFalse(options.has("f")); assertFalse(options.has("o")); }
@Test public void resolvesToLongOptionWithSingleDashEvenWithMatchingShortOptions() { OptionSet options = parser.parse("-fox"); assertTrue(options.has("fox")); assertFalse(options.has("f")); assertFalse(options.has("o")); assertFalse(options.has("x")); }
@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 singleLongOptionAbbreviated() { OptionSet options = parser.parse("--verbo"); assertTrue(options.has("verbose")); assertFalse(options.has("verb")); assertEquals(emptyList(), options.valuesOf("verbose")); assertEquals(emptyList(), options.nonOptionArguments()); }
@Test public void withArgumentComingAfterCluster() { OptionSet options = parser.parse("-fox", "bar"); assertTrue(options.has("fox")); assertFalse(options.has("f")); assertFalse(options.has("o")); assertFalse(options.has("x")); assertEquals(singletonList("bar"), options.nonOptionArguments()); }
@Test public void resolvesShortOptionToShortOptionEvenWithDoubleHyphen() { OptionSet options = parser.parse("--f"); assertFalse(options.has("fox")); assertTrue(options.has("f")); }
@Test public void resolvesShortOptionToShortOption() { OptionSet options = parser.parse("-f"); assertFalse(options.has("fox")); assertTrue(options.has("f")); }