rewrite of closure capturing for object literals
This commit is contained in:
@@ -139,6 +139,55 @@ public class ArrayGenTest extends CodegenTestCase {
|
||||
foo.invoke(null);
|
||||
}
|
||||
|
||||
public void testByteIterator () throws Exception {
|
||||
loadText("fun box() { val x = ByteArray(5).iterator(); while(x.hasNext) { java.lang.System.out?.println(x.next()) } }");
|
||||
System.out.println(generateToText());
|
||||
Method foo = generateFunction();
|
||||
foo.invoke(null);
|
||||
}
|
||||
|
||||
public void testShortIterator () throws Exception {
|
||||
loadText("fun box() { val x = ShortArray(5).iterator(); while(x.hasNext) { java.lang.System.out?.println(x.next()) } }");
|
||||
System.out.println(generateToText());
|
||||
Method foo = generateFunction();
|
||||
foo.invoke(null);
|
||||
}
|
||||
|
||||
public void testIntIterator () throws Exception {
|
||||
loadText("fun box() { val x = IntArray(5).iterator(); while(x.hasNext) { java.lang.System.out?.println(x.next()) } }");
|
||||
System.out.println(generateToText());
|
||||
Method foo = generateFunction();
|
||||
foo.invoke(null);
|
||||
}
|
||||
|
||||
public void testLongIterator2 () throws Exception {
|
||||
loadText("fun box() { val x = LongArray(5).iterator(); while(x.hasNext) { java.lang.System.out?.println(x.next()) } }");
|
||||
System.out.println(generateToText());
|
||||
Method foo = generateFunction();
|
||||
foo.invoke(null);
|
||||
}
|
||||
|
||||
public void testFloatIterator () throws Exception {
|
||||
loadText("fun box() { val x = FloatArray(5).iterator(); while(x.hasNext) { java.lang.System.out?.println(x.next()) } }");
|
||||
System.out.println(generateToText());
|
||||
Method foo = generateFunction();
|
||||
foo.invoke(null);
|
||||
}
|
||||
|
||||
public void testDoubleIterator () throws Exception {
|
||||
loadText("fun box() { val x = ShortArray(5).iterator(); while(x.hasNext) { java.lang.System.out?.println(x.next()) } }");
|
||||
System.out.println(generateToText());
|
||||
Method foo = generateFunction();
|
||||
foo.invoke(null);
|
||||
}
|
||||
|
||||
public void testBooleanIterator () throws Exception {
|
||||
loadText("fun box() { val x = BooleanArray(5).iterator(); while(x.hasNext) { java.lang.System.out?.println(x.next()) } }");
|
||||
System.out.println(generateToText());
|
||||
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());
|
||||
|
||||
@@ -24,7 +24,7 @@ public class ClassGenTest extends CodegenTestCase {
|
||||
loadFile("classes/inheritingFromArrayList.jet");
|
||||
|
||||
final Class aClass = loadClass("Foo", generateClassesInFile());
|
||||
checkInterface(aClass, List.class);
|
||||
assertInstanceOf(aClass.newInstance(), List.class);
|
||||
}
|
||||
|
||||
public void testInheritanceAndDelegation_DelegatingDefaultConstructorProperties() throws Exception {
|
||||
@@ -47,13 +47,6 @@ public class ClassGenTest extends CodegenTestCase {
|
||||
blackBoxFile("classes/rightHandOverride.jet");
|
||||
}
|
||||
|
||||
private static void checkInterface(Class aClass, Class ifs) {
|
||||
for (Class anInterface : aClass.getInterfaces()) {
|
||||
if (anInterface == ifs) return;
|
||||
}
|
||||
fail(aClass.getName() + " must have " + ifs.getName() + " in its interfaces");
|
||||
}
|
||||
|
||||
public void testNewInstanceExplicitConstructor() throws Exception {
|
||||
loadFile("classes/newInstanceDefaultConstructor.jet");
|
||||
System.out.println(generateToText());
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package org.jetbrains.jet.codegen;
|
||||
|
||||
/**
|
||||
* @author alex.tkachman
|
||||
*/
|
||||
public class StdlibTest extends CodegenTestCase {
|
||||
public void testInputStreamIterator () {
|
||||
blackBoxFile("inputStreamIterator.jet");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user