public void actorTest(Actorscript test) throws Exception {
   try {
     ELActor.currentActor().sync_event_performTest(test);
   } catch (XParseError e) {
     fail("Parse error: " + e.getMessage());
   } catch (InterpreterException e) {
     e.printStackTrace();
     fail("Eval error: " + e.getMessage());
   }
 }
 public ATObject evalAndReturn(String input) {
   try {
     ATAbstractGrammar ptree = NATParser._INSTANCE_.base_parse(NATText.atValue(input));
     return ptree.meta_eval(ctx_);
   } catch (XParseError e) {
     fail("Parse error: " + e.getMessage());
   } catch (InterpreterException e) {
     e.printStackTrace();
     fail("Eval error: " + e.getMessage());
   }
   return null;
 }
 public ATObject evalInActor(String input) {
   try {
     ATAbstractGrammar ptree = NATParser._INSTANCE_.base_parse(NATText.atValue(input));
     return ELActor.currentActor().sync_event_eval(ptree);
   } catch (XParseError e) {
     fail("Parse error: " + e.getMessage());
   } catch (InterpreterException e) {
     e.printStackTrace();
     fail("Eval error: " + e.getMessage());
   }
   return null;
 }
Ejemplo n.º 4
0
 public void testInvalidEncodingInput() throws InterpreterException {
   String givenInput = "Negation_sign: ¬; Accented_e: é ";
   try {
     String brokenInput = new String(givenInput.getBytes("ISO-8859-1"), "UTF-8");
     NATParser.parse("testfile", brokenInput);
     fail("Parsing a string with invalid bytes should raise an error");
   } catch (UnsupportedEncodingException ignored) {
     /* won't happen */
   } catch (XParseError e) {
     assertEquals("The error should reference line 1, column 16", 1, e.getLine());
     assertEquals("The error should reference line 1, column 16", 16, e.getColumn());
   }
 }