Exemplo n.º 1
0
  public void testInvalid() {
    Enumeration e = invalidRsls.keys();
    String key;
    String rsl;
    while (e.hasMoreElements()) {
      key = (String) e.nextElement();
      rsl = invalidRsls.getProperty(key);

      System.out.println("Parsing invalid rsl " + key + ": " + rsl);
      try {
        RslNode tree = RSLParser.parse(rsl);
        fail("Failed to catch parse error of " + rsl);
      } catch (Exception ex) {
      }
    }
  }
Exemplo n.º 2
0
  public void testValid() {
    Enumeration e = validRsls.keys();
    String key;
    String rsl;
    while (e.hasMoreElements()) {
      key = (String) e.nextElement();
      rsl = validRsls.getProperty(key);

      System.out.println("Parsing valid rsl " + key + ": " + rsl);
      try {
        RSLParser.parse(rsl);
      } catch (Exception ex) {
        ex.printStackTrace();
        fail("Failed to parse!!!");
      }
    }
  }
Exemplo n.º 3
0
  public void setUp() {
    validRsls = new Properties();
    validRsls.put("rsl1", "+(&(executable=myprogram)(stdin<2.4))(&(stdin=8)   \n\n\n(stdin=0))");
    validRsls.put("rsl2", "&(executable=myprogram)(stdin<2.4)(stdin=8)(stdin=0)");
    validRsls.put("rsl3", "&(a=a)(a=b)");
    validRsls.put("rsl4", " &(a=a)");
    validRsls.put(
        "rsl5",
        "(* dont use this comment *)\n&(string=\"my name is \"\"Nick Karonis\"\" today\") (*or this one*)");
    validRsls.put("rsl6", "&(&(&(&(a=a))))");
    validRsls.put("rsl7", "&(args=\"aa ) bb\")");
    validRsls.put("rsl8", "+(&(executable=myprogram)(stdin<2.4))(|(stdin=8)   \n\n\n(stdin=0))");
    validRsls.put(
        "rsl9",
        "+(&(executable=myprogram)(stdin<2.4)(|(a=bbb)(yyy=z)))(|(stdin=8)   \n\n\n(stdin=0))");
    validRsls.put("rsl10", "&(args=hello \n\n)");
    validRsls.put("rsl11", "&(executable=\"\")");
    validRsls.put("rsl12", "&(executable=\"abc \"\" \"\" def\")");
    // validRsls.put("rsl13", "args=\"aa ) \"\"bb cc dd\"");
    validRsls.put(
        "rsl14",
        "&((*comment*)string(*comment*) \n=(*comment\ncontinue comment*)\"my (* ok *) name is \"\"Nick Karonis\"\" today\"(*comment*)) (* or this one *)");
    validRsls.put(
        "rsl15",
        "&(* dont use this comment *)\n(\n(*comment*)string(*comment*)\n=(*comment\ncontinue comment*)\"my name is \"\"Nick Karonis\"\" today\"(*comment*)) (*or this one*)");
    // validRsls.put("rsl16", "(* dont use this comment *)\n(* comment*) string  (*
    // comment*)\n=(*comment\ncontinue comment*)\"my name is \"\"Nick Karonis\"\" today\"(*comment*)
    // (*or this one*)");
    validRsls.put(
        "rsl17",
        "+(* dont use this comment *)\n((*comment*)string(*comment*)=(*comment\ncontinue comment*)\"my name is \"\"Nick Karonis\"\" today\"(*comment*)) (*or this one*)");
    validRsls.put("rsl18", "+(string='let''s try ''single quotes'' with \"double too\" ok')");

    invalidRsls = new Properties();

    invalidRsls.put("rsl1", "(my executable=a.out)");
    invalidRsls.put("rsl2", "(executable=/home /a.ou:t#22)");
    invalidRsls.put("rsl3", "&(args=dddd)(executable=)(more_args=ooo)");
    invalidRsls.put("rsl4", "(executable=^$test $$$  quotes$)");
    invalidRsls.put("rsl5", "(executable=^$my value $ \nmore \"\"\" stuff)");
    invalidRsls.put("rsl6", "(executable=)");
    invalidRsls.put("rsl7", "(args=\"\"a\"\"b\")");
    invalidRsls.put("rsl8", "(args=hello \n\nworld)");
    invalidRsls.put("rsl9", "(arguments=\"ccc ddd\"\"zzz\"\")");
    // invalidRsls.put("rsl10", "&(arguments=\"\"\"\"\")(exe=abc)");
    invalidRsls.put("rsl11", "(a=a)");
    invalidRsls.put(
        "rsl12", "+(&(executable=myprogram)(stdin<2.4))(+(stdin=8)   \n\n\n(stdin=0))+");
    invalidRsls.put("rsl13", "(=a.out)");
    invalidRsls.put("rsl14", "(executable=\")");
    invalidRsls.put("rsl15", "(executable=^\")");
    invalidRsls.put("rsl16", "(executable=^/)");
  }