make most codegen tests are indenendent from jdk-headers/stdlib now

This commit is contained in:
Stepan Koltsov
2012-05-01 23:49:22 +04:00
parent 518f50692f
commit 5e77ca553c
33 changed files with 232 additions and 176 deletions
@@ -16,6 +16,8 @@
package org.jetbrains.jet.codegen;
import org.jetbrains.jet.lang.resolve.java.CompilerSpecialMode;
import java.lang.reflect.Array;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@@ -25,7 +27,7 @@ import java.lang.reflect.Method;
*/
public class VarArgTest extends CodegenTestCase {
public void testStringArray () throws InvocationTargetException, IllegalAccessException {
createEnvironmentWithMockJdk();
createEnvironmentWithMockJdk(CompilerSpecialMode.JDK_HEADERS);
loadText("fun test(vararg ts: String) = ts");
// System.out.println(generateToText());
final Method main = generateFunction();
@@ -34,7 +36,7 @@ public class VarArgTest extends CodegenTestCase {
}
public void testIntArray () throws InvocationTargetException, IllegalAccessException {
createEnvironmentWithMockJdk();
createEnvironmentWithMockJdk(CompilerSpecialMode.JDK_HEADERS);
loadText("fun test(vararg ts: Int) = ts");
// System.out.println(generateToText());
final Method main = generateFunction();
@@ -43,7 +45,7 @@ public class VarArgTest extends CodegenTestCase {
}
public void testIntArrayKotlinNoArgs () throws InvocationTargetException, IllegalAccessException {
createEnvironmentWithMockJdk();
createEnvironmentWithMockJdk(CompilerSpecialMode.JDK_HEADERS);
loadText("fun test() = testf(); fun testf(vararg ts: Int) = ts");
// System.out.println(generateToText());
final Method main = generateFunction("test");
@@ -52,7 +54,7 @@ public class VarArgTest extends CodegenTestCase {
}
public void testIntArrayKotlin () throws InvocationTargetException, IllegalAccessException {
createEnvironmentWithMockJdk();
createEnvironmentWithMockJdk(CompilerSpecialMode.JDK_HEADERS);
loadText("fun test() = testf(239, 7); fun testf(vararg ts: Int) = ts");
// System.out.println(generateToText());
final Method main = generateFunction("test");
@@ -63,7 +65,7 @@ public class VarArgTest extends CodegenTestCase {
}
public void testNullableIntArrayKotlin () throws InvocationTargetException, IllegalAccessException {
createEnvironmentWithMockJdk();
createEnvironmentWithMockJdk(CompilerSpecialMode.JDK_HEADERS);
loadText("fun test() = testf(239.toByte(), 7.toByte()); fun testf(vararg ts: Byte?) = ts");
// System.out.println(generateToText());
final Method main = generateFunction("test");
@@ -74,7 +76,7 @@ public class VarArgTest extends CodegenTestCase {
}
public void testIntArrayKotlinObj () throws InvocationTargetException, IllegalAccessException {
createEnvironmentWithMockJdk();
createEnvironmentWithMockJdk(CompilerSpecialMode.JDK_HEADERS);
loadText("fun test() = testf(\"239\"); fun testf(vararg ts: String) = ts");
// System.out.println(generateToText());
final Method main = generateFunction("test");
@@ -84,7 +86,7 @@ public class VarArgTest extends CodegenTestCase {
}
public void testArrayT () throws InvocationTargetException, IllegalAccessException {
createEnvironmentWithMockJdk();
createEnvironmentWithMockJdk(CompilerSpecialMode.JDK_HEADERS);
loadText("fun test() = _array(2, 4); fun <T> _array(vararg elements : T) = elements");
// System.out.println(generateToText());
final Method main = generateFunction("test");
@@ -100,12 +102,12 @@ public class VarArgTest extends CodegenTestCase {
}
public void testKt797() {
createEnvironmentWithMockJdk();
createEnvironmentWithMockJdk(CompilerSpecialMode.JDK_HEADERS);
blackBoxFile("regressions/kt796_797.jet");
}
public void testArrayAsVararg () throws InvocationTargetException, IllegalAccessException {
createEnvironmentWithMockJdk();
createEnvironmentWithMockJdk(CompilerSpecialMode.JDK_HEADERS);
loadText("private fun asList(vararg elems: String) = elems; fun test(ts: Array<String>) = asList(*ts); ");
//System.out.println(generateToText());
final Method main = generateFunction("test");
@@ -114,7 +116,7 @@ public class VarArgTest extends CodegenTestCase {
}
public void testArrayAsVararg2 () throws InvocationTargetException, IllegalAccessException {
createEnvironmentWithMockJdk();
createEnvironmentWithMockJdk(CompilerSpecialMode.JDK_HEADERS);
loadText("private fun asList(vararg elems: String) = elems; fun test(ts1: Array<String>, ts2: String) = asList(*ts1, ts2); ");
System.out.println(generateToText());
final Method main = generateFunction("test");