Esempio n. 1
0
 @Before
 public void setUp() throws Exception {
   lastTestFailed = false; // hope for the best, but set to true in asserts that fail
   // new output dir for each test
   tmpdir =
       new File(
               System.getProperty("java.io.tmpdir"),
               "antlr-" + getClass().getName() + "-" + System.currentTimeMillis())
           .getAbsolutePath();
   ErrorManager.resetErrorState();
 }
Esempio n. 2
0
 protected void checkError(ErrorQueue equeue, Message expectedMessage) throws Exception {
   // System.out.println("errors="+equeue);
   Message foundMsg = null;
   for (int i = 0; i < equeue.errors.size(); i++) {
     Message m = (Message) equeue.errors.get(i);
     if (m.msgID == expectedMessage.msgID) {
       foundMsg = m;
     }
   }
   assertTrue("no error; " + expectedMessage.msgID + " expected", equeue.errors.size() > 0);
   assertTrue("too many errors; " + equeue.errors, equeue.errors.size() <= 1);
   assertNotNull("couldn't find expected error: " + expectedMessage.msgID, foundMsg);
   /*
   assertTrue("error is not a GrammarSemanticsMessage",
              foundMsg instanceof GrammarSemanticsMessage);
    */
   assertEquals(expectedMessage.arg, foundMsg.arg);
   assertEquals(expectedMessage.arg2, foundMsg.arg2);
   ErrorManager.resetErrorState(); // wack errors for next test
 }