generate .size property for arrays

This commit is contained in:
Dmitry Jemerov
2011-05-20 13:54:15 +02:00
parent c943525e08
commit 4c7768b47d
2 changed files with 23 additions and 6 deletions
@@ -367,6 +367,16 @@ public class NamespaceGenTest extends CodegenTestCase {
assertEquals(4, result.length);
}
public void testArraySize() throws Exception {
loadText("fun foo(a: Array<Int>) = a.size");
System.out.println(generateToText());
final Method main = generateFunction();
Object[] args = new Object[] { new int[4] };
int result = (Integer) main.invoke(null, args);
assertEquals(4, result);
}
public void testIntRange() throws Exception {
loadText("fun foo() = 1..10");
final Method main = generateFunction();