Пример #1
0
  public void testRenameWithInit() {
    field.setInitializer(fact.newStringLiteral("foo"));
    assertTrue(field.getInitializer() instanceof ASStringLiteral);

    field.setName("foo");
    // renaming the field should cause the initialiser to vanish
    assertNotNull(field.getInitializer());
  }
Пример #2
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);
  }