Example #1
0
 public void testConstSerialisation() throws IOException {
   field.setConst(true);
   field.setName("renamed");
   unit = CodeMirror.assertReflection(fact, unit);
   field = ((ASClassType) unit.getType()).getField("renamed");
   assertNotNull(field);
   assertTrue(field.isConst());
 }
Example #2
0
 public void tearDown() {
   if (expr != null) {
     StringWriter buff = new StringWriter();
     LinkedListTree ast = ((ASTExpression) expr).getAST();
     new ASTPrinter(buff).print(ast);
     LinkedListTree parsed = AS3FragmentParser.parseExpr(buff.toString());
     CodeMirror.assertASTMatch(ast, parsed);
   }
 }
Example #3
0
  public void testInit() throws IOException {
    // should no none to start with,
    assertNull(field.getInitializer());

    field.setInitializer(fact.newStringLiteral("foo"));
    assertTrue(field.getInitializer() instanceof ASStringLiteral);

    field.setInitializer("1");
    assertTrue(field.getInitializer() instanceof ASIntegerLiteral);

    field.setInitializer((String) null); // remove it again
    assertNull(field.getInitializer());

    field.setInitializer((Expression) null); // when already absent

    // complicated initialiser value,
    field.setInitializer("function() { trace('test'); }");
    CodeMirror.assertReflection(fact, unit);
  }
Example #4
0
 protected void tearDown() throws IOException {
   CodeMirror.assertReflection(fact, unit);
 }