Пример #1
0
 public void test_SameFirstChar() throws Exception {
   CommandLine getopt = new CommandLine(rp);
   CommandTwoOptions c = new CommandTwoOptions();
   getopt.execute(c, "commandTwoOptions", new ExtList<String>("-t", "test", "-T", "title"));
   assertEquals("title", c.title);
   assertEquals("test", c.test);
 }
Пример #2
0
 public void test_SameFirstChar_MaxTwoOptionsWithSameShortcut() throws Exception {
   CommandLine getopt = new CommandLine(rp);
   CommandThreeOptions c = new CommandThreeOptions();
   try {
     getopt.execute(c, "commandThreeOptions", new ExtList<String>());
     fail();
   } catch (Error e) {
   }
 }
Пример #3
0
 public void test_SameFirstChar_NoCapitalizedCommands() throws Exception {
   CommandLine getopt = new CommandLine(rp);
   CommandWrongOption c = new CommandWrongOption();
   try {
     getopt.execute(c, "commandWrongOption", new ExtList<String>());
     fail();
   } catch (Error e) {
   }
 }
Пример #4
0
 public void testSimple() throws Exception {
   CommandLine getopt = new CommandLine(rp);
   C1 c1 = new C1();
   String help =
       getopt.execute(
           c1,
           "c1",
           new ExtList<String>(
               "-f", "-a", "33", "--bb", "bb", "-i", "f1.txt", "-i", "f2.txt", "--", "-a", "--a",
               "a"));
   System.err.println(help);
 }
Пример #5
0
 public void testHelp() throws Exception {
   CommandLine getopt = new CommandLine(rp);
   C1 c1 = new C1();
   getopt.execute(c1, "help", new ExtList<String>("c1"));
 }
Пример #6
0
  public void testCommand() throws Exception {
    CommandLine getopt = new CommandLine(rp);
    assertEquals("[cmda, cmdb]", getopt.getCommands(new X()).keySet().toString());

    getopt.execute(new X(), "cmda", Arrays.asList("-e", "help"));
  }