01: /*
02: Copyright 2004-2007 Paul R. Holser, Jr. All rights reserved.
03: Licensed under the Academic Free License version 3.0
04: */
05:
06: package joptsimple;
07:
08: /**
09: * @author <a href="mailto:pholser@alumni.rice.edu">Paul Holser</a>
10: * @version $Id: ClusterVersusLongOptionTest.java,v 1.11 2007/04/10 20:06:27 pholser Exp $
11: */
12: public class ClusterVersusLongOptionTest extends
13: AbstractOptionParserFixture {
14: protected void setUp() throws Exception {
15: super .setUp();
16:
17: parser.accepts("fox");
18: parser.accepts("f");
19: parser.accepts("o");
20: parser.accepts("x");
21: }
22:
23: public void testResolvesToLongOption() {
24: OptionSet options = parser.parse(new String[] { "--fox" });
25: assertTrue(options.wasDetected("fox"));
26: assertFalse(options.wasDetected("f"));
27: assertFalse(options.wasDetected("o"));
28: assertFalse(options.wasDetected("x"));
29: }
30:
31: public void testResolvesToLongOptionSingleDash() {
32: OptionSet options = parser.parse(new String[] { "-fox" });
33: assertTrue(options.wasDetected("fox"));
34: assertFalse(options.wasDetected("f"));
35: assertFalse(options.wasDetected("o"));
36: assertFalse(options.wasDetected("x"));
37: }
38:
39: public void testResolvesToLongOptionAbbreviated() {
40: OptionSet options = parser.parse(new String[] { "-fo" });
41: assertTrue(options.wasDetected("fox"));
42: assertFalse(options.wasDetected("f"));
43: assertFalse(options.wasDetected("o"));
44: }
45:
46: public void testResolvesToShortOption() {
47: OptionSet options = parser.parse(new String[] { "-f" });
48: assertFalse(options.wasDetected("fox"));
49: assertTrue(options.wasDetected("f"));
50: }
51:
52: public void testResolvesToShortOptionDoubleDash() {
53: OptionSet options = parser.parse(new String[] { "--f" });
54: assertFalse(options.wasDetected("fox"));
55: assertTrue(options.wasDetected("f"));
56: }
57: }
|