Example #1
0
  @Test
  public void test_Object() throws IOException {
    Result result = compile();
    assertTrue(result.success);

    ClassReference Object = model.getClassReference("Object");
    assertNotNull(Object);
    assertTrue(Object.isDynamic());
  }
Example #2
0
  @Test
  public void test_Array() throws IOException {
    Result result = compile();
    assertTrue(result.success);

    ClassReference Array = model.getClassReference("Array");
    assertNotNull(Array);

    MethodReference constructor = Array.getConstructor();
    StringBuilder sb = new StringBuilder();
    constructor.emitCode(sb);
    String emit = sb.toString();
    assertEquals("    public function Array(...var_args):Array {  return null; }\n", emit);
  }
Example #3
0
  @Test
  public void test_Array_indexOf() throws IOException {
    Result result = compile();
    assertTrue(result.success);

    ClassReference Array = model.getClassReference("Array");
    assertNotNull(Array);

    MethodReference indexOf = Array.getInstanceMethod("indexOf");
    StringBuilder sb = new StringBuilder();
    indexOf.emitCode(sb);
    String emit = sb.toString();
    assertEquals(
        "    public function indexOf(obj:Object, opt_fromIndex:Number = 0):Number { return 0; }\n",
        emit);
  }