@Test public void testOneOpt() { args = listOf("-a"); expectedOpts = setOf("a"); checkArgLimits(UnknownOptionException.class, 0, 0); checkArgLimits(null, 0, 0, "a", "b"); checkArgLimits(NotEnoughArgumentsException.class, 1, 1, "a", "b"); }
@Test public void testTwoOpts() { args = listOf("-a", "-b"); expectedOpts = setOf("a", "b"); checkArgLimits(UnknownOptionException.class, 0, 0); checkArgLimits(null, 0, 0, "a", "b"); checkArgLimits(null, 0, 1, "a", "b"); checkArgLimits(NotEnoughArgumentsException.class, 1, 1, "a", "b"); }
@Test public void testOptArg() { args = listOf("-a", "b"); expectedOpts = setOf("a"); expectedArgs = listOf("b"); checkArgLimits(UnknownOptionException.class, 0, 0); checkArgLimits(TooManyArgumentsException.class, 0, 0, "a", "b"); checkArgLimits(null, 0, 1, "a", "b"); checkArgLimits(null, 1, 1, "a", "b"); checkArgLimits(null, 1, 2, "a", "b"); checkArgLimits(NotEnoughArgumentsException.class, 2, 2, "a", "b"); }
@Test public void testOptStopOptArg() { args = listOf("-a", "--", "-b", "c"); expectedOpts = setOf("a"); expectedArgs = listOf("-b", "c"); checkArgLimits(UnknownOptionException.class, 0, 0); checkArgLimits(TooManyArgumentsException.class, 0, 1, "a", "b"); checkArgLimits(null, 2, 2, "a", "b"); checkArgLimits(NotEnoughArgumentsException.class, 3, 4, "a", "b"); }
@Test public void testOptDashArg() { args = listOf("-b", "-", "-c"); expectedOpts = setOf("b"); expectedArgs = listOf("-", "-c"); checkArgLimits(UnknownOptionException.class, 0, 0); checkArgLimits(TooManyArgumentsException.class, 0, 0, "b", "c"); checkArgLimits(TooManyArgumentsException.class, 1, 1, "b", "c"); checkArgLimits(null, 2, 2, "b", "c"); checkArgLimits(NotEnoughArgumentsException.class, 3, 4, "b", "c"); }