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: import junit.framework.TestCase;
09:
10: /**
11: * @author <a href="mailto:pholser@alumni.rice.edu">Paul Holser</a>
12: * @version $Id: CreateWithOptionSpecificationStringTest.java,v 1.11 2007/04/10 20:06:26 pholser Exp $
13: */
14: public class CreateWithOptionSpecificationStringTest extends TestCase {
15: public void testCreateWithOptionSpecificationString() {
16: OptionParser first = new OptionParser() {
17: {
18: accepts("i").withOptionalArg();
19: accepts("j").withRequiredArg();
20: accepts("k");
21: }
22: };
23:
24: OptionParser second = new OptionParser("i::j:k");
25:
26: String[] args = new String[] { "-k", "-ifoo", "-jbar" };
27: assertEquals(first.parse(args), second.parse(args));
28: }
29: }
|