array.indices

This commit is contained in:
Alex Tkachman
2011-10-08 16:26:49 +02:00
parent 78e913762f
commit e94087f41e
8 changed files with 246 additions and 47 deletions
@@ -86,4 +86,18 @@ public class ArrayGenTest extends CodegenTestCase {
Method foo = generateFunction();
foo.invoke(null);
}
public void testArrayIndices () throws Exception {
loadText("fun box() { val x = Array<Int>(5, {it}).indices.iterator(); while(x.hasNext()) { java.lang.System.out?.println(x.next()) } }");
System.out.println(generateToText());
Method foo = generateFunction();
foo.invoke(null);
}
public void testCharIndices () throws Exception {
loadText("fun box() { val x = CharArray(5).indices.iterator(); while(x.hasNext()) { java.lang.System.out?.println(x.next()) } }");
System.out.println(generateToText());
Method foo = generateFunction();
foo.invoke(null);
}
}
@@ -433,8 +433,8 @@ public class NamespaceGenTest extends CodegenTestCase {
final Method main = generateFunction();
IntRange result = (IntRange) main.invoke(null);
assertTrue(result.contains(1));
assertTrue(result.contains(10));
assertFalse(result.contains(11));
assertTrue(result.contains(9));
assertFalse(result.contains(10));
}
public void testSubstituteJavaMethodTypeParameters() throws Exception {