1 | assertEquals(FILE_OPT, ((CLOption) clOptions.get(0)).getDescriptor().getId());↵ | | 1 | assertEquals(FILE_OPT, ((CLOption) clOptions.get(2)).getDescriptor().getId());↵
|
2 | assertEquals("-=-", ((CLOption) clOptions.get(0)).getArgument());↵ | | 2 | assertEquals("a", ((CLOption) clOptions.get(2)).getArgument());↵
|
3 | }↵ | | 3 | }↵
|
|
4 | public void testCombinedArgs1() {↵ | | 4 | public void testCombinedArgs3() {↵
|
5 | final CLOptionDescriptor[] options = new CLOptionDescriptor[] { BLEE, TAINT };↵ | | 5 | final CLOptionDescriptor[] options = new CLOptionDescriptor[] { BLEE, TAINT, FILE };↵
|
|
6 | final CLArgsParser parser = new CLArgsParser(new String[] { "-bT", "rest" }↵ | | 6 | final CLArgsParser parser = new CLArgsParser(new String[] { "-bT", "--", "-fa" }// Should↵
|
| | | 7 | // not↵
|
| | | 8 | // detect↵
|
| | | 9 | // trailing↵
|
| | | 10 | // option↵
|
7 | , options);↵ | | 11 | , options);↵
|
|
8 | assertNull(parser.getErrorString(), parser.getErrorString());↵ | | 12 | assertNull(parser.getErrorString(), parser.getErrorString());↵
|
|
9 | final List clOptions = parser.getArguments();↵ | | 13 | final List clOptions = parser.getArguments();↵
|
10 | final int size = clOptions.size();↵ | | 14 | final int size = clOptions.size();↵
|
11 | assertEquals(3, size);↵ | | 15 | assertEquals(3, size);↵
|
12 | assertEquals(BLEE_OPT, ((CLOption) clOptions.get(0)).getDescriptor().getId());↵ | | 16 | assertEquals(BLEE_OPT, ((CLOption) clOptions.get(0)).getDescriptor().getId());↵
|
13 | assertEquals(TAINT_OPT, ((CLOption) clOptions.get(1)).getDescriptor().getId());↵ | | 17 | assertEquals(TAINT_OPT, ((CLOption) clOptions.get(1)).getDescriptor().getId());↵
|
14 | assertEquals(0, ((CLOption) clOptions.get(2)).getDescriptor().getId());↵ | | 18 | assertEquals(0, ((CLOption) clOptions.get(2)).getDescriptor().getId());↵
|
15 | assertEquals("rest", ((CLOption) clOptions.get(2)).getArgument());↵ | | 19 | assertEquals("-fa", ((CLOption) clOptions.get(2)).getArgument());↵
|
16 | }↵ | | 20 | }↵
|
|
17 | public void testCombinedArgs2() {↵ | | 21 | public void testCombinedArgs4() {↵
|
18 | final CLOptionDescriptor[] options = new CLOptionDescriptor[] { BLEE, TAINT, FILE };↵ | | 22 | final CLOptionDescriptor[] options = new CLOptionDescriptor[] { BLEE, TAINT, FILE };↵
|
|
19 | final CLArgsParser parser = new CLArgsParser(new String[] { "-bT", "-fa" }↵ | | 23 | final CLArgsParser parser = new CLArgsParser(new String[] { "-bT", "rest", "-fa" } // should↵
|
| | | 24 | // detect↵
|
| | | 25 | // trailing↵
|
| | | 26 | // option↵
|
20 | , options);↵ | | 27 | , options);↵
|
|
21 | assertNull(parser.getErrorString(), parser.getErrorString());↵ | | 28 | assertNull(parser.getErrorString(), parser.getErrorString());↵
|
|
22 | final List clOptions = parser.getArguments();↵ | | 29 | final List clOptions = parser.getArguments();↵
|
23 | final int size = clOptions.size();↵ | | 30 | final int size = clOptions.size();↵
|
24 | assertEquals(3, size);↵ | | 31 | assertEquals(4, size);↵
|
25 | assertEquals(BLEE_OPT, ((CLOption) clOptions.get(0)).getDescriptor().getId());↵ | | 32 | assertEquals(BLEE_OPT, ((CLOption) clOptions.get(0)).getDescriptor().getId());↵
|
26 | assertEquals(TAINT_OPT, ((CLOption) clOptions.get(1)).getDescriptor().getId());↵ | | 33 | assertEquals(TAINT_OPT, ((CLOption) clOptions.get(1)).getDescriptor().getId());↵
|
27 | assertEqual | | 34 | assertEqual
|