Example #1
0
  public void testParsePipe() throws Exception {
    assertEquals(Operator.EDIT, Parser.parseOperator(Parser.tokenize("|")));
    assertEquals(Operator.TRANSLATE, Parser.parseOperator(Parser.tokenize(">")));

    assertParseOperatorFails("a", "Invalid operator \"Token[a], line 1\"");
    assertParseOperatorFails("-", "Invalid operator \"Token['-'], line 1\"");
  }
Example #2
0
 public void assertParseOperatorFails(String input, String errorMessage) {
   try {
     Parser.parseOperator(Parser.tokenize(input));
     fail();
   } catch (Parser.ParseError e) {
     assertEquals("Cannot parse: " + errorMessage, e.getMessage());
   }
 }