Revert "enhance tests (mostly codegen)" temporarily

This reverts commit 95f9bcbacb.
This commit is contained in:
Stepan Koltsov
2012-05-01 21:21:46 +04:00
parent 035fd686e0
commit d71723131d
43 changed files with 44 additions and 379 deletions
@@ -16,8 +16,6 @@
package org.jetbrains.jet.codegen;
import org.jetbrains.jet.lang.resolve.java.CompilerSpecialMode;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Arrays;
@@ -33,7 +31,6 @@ public class ControlStructuresTest extends CodegenTestCase {
}
public void testIf() throws Exception {
createEnvironmentWithMockJdk(CompilerSpecialMode.JDK_HEADERS);
loadFile();
// System.out.println(generateToText());
@@ -43,7 +40,6 @@ public class ControlStructuresTest extends CodegenTestCase {
}
public void testSingleBranchIf() throws Exception {
createEnvironmentWithMockJdk(CompilerSpecialMode.JDK_HEADERS);
loadFile();
// System.out.println(generateToText());
@@ -65,7 +61,6 @@ public class ControlStructuresTest extends CodegenTestCase {
}
private void factorialTest(final String name) throws IllegalAccessException, InvocationTargetException {
createEnvironmentWithMockJdk(CompilerSpecialMode.JDK_HEADERS);
loadFile(name);
// System.out.println(generateToText());
@@ -75,7 +70,6 @@ public class ControlStructuresTest extends CodegenTestCase {
}
public void testContinue() throws Exception {
createEnvironmentWithMockJdk(CompilerSpecialMode.JDK_HEADERS);
loadFile();
// System.out.println(generateToText());
final Method main = generateFunction();
@@ -84,7 +78,6 @@ public class ControlStructuresTest extends CodegenTestCase {
}
public void testIfNoElse() throws Exception {
createEnvironmentWithMockJdk(CompilerSpecialMode.JDK_HEADERS);
loadFile();
// System.out.println(generateToText());
final Method main = generateFunction();
@@ -93,7 +86,6 @@ public class ControlStructuresTest extends CodegenTestCase {
}
public void testCondJumpOnStack() throws Exception {
createEnvironmentWithMockJdk(CompilerSpecialMode.JDK_HEADERS);
loadText("import java.lang.Boolean as jlBoolean; fun foo(a: String): Int = if (jlBoolean.parseBoolean(a)) 5 else 10");
final Method main = generateFunction();
assertEquals(5, main.invoke(null, "true"));
@@ -101,7 +93,6 @@ public class ControlStructuresTest extends CodegenTestCase {
}
public void testFor() throws Exception {
createEnvironmentWithMockJdk(CompilerSpecialMode.JDK_HEADERS);
loadFile();
// System.out.println(generateToText());
final Method main = generateFunction();
@@ -110,7 +101,6 @@ public class ControlStructuresTest extends CodegenTestCase {
}
public void testIfBlock() throws Exception {
createEnvironmentWithMockJdk(CompilerSpecialMode.JDK_HEADERS);
loadFile();
// System.out.println(generateToText());
final Method main = generateFunction();
@@ -121,7 +111,6 @@ public class ControlStructuresTest extends CodegenTestCase {
}
public void testForInArray() throws Exception {
createEnvironmentWithMockJdk(CompilerSpecialMode.JDK_HEADERS);
loadFile();
// System.out.println(generateToText());
final Method main = generateFunction();
@@ -130,7 +119,6 @@ public class ControlStructuresTest extends CodegenTestCase {
}
public void testForInRange() throws Exception {
createEnvironmentWithMockJdk(CompilerSpecialMode.JDK_HEADERS);
loadText("fun foo(sb: StringBuilder) { for(x in 1..4) sb.append(x) }");
final Method main = generateFunction();
StringBuilder stringBuilder = new StringBuilder();
@@ -139,7 +127,6 @@ public class ControlStructuresTest extends CodegenTestCase {
}
public void testThrowCheckedException() throws Exception {
createEnvironmentWithMockJdk(CompilerSpecialMode.JDK_HEADERS);
loadText("fun foo() { throw Exception(); }");
final Method main = generateFunction();
boolean caught = false;
@@ -154,7 +141,6 @@ public class ControlStructuresTest extends CodegenTestCase {
}
public void testTryCatch() throws Exception {
createEnvironmentWithMockJdk(CompilerSpecialMode.JDK_HEADERS);
loadFile();
// System.out.println(generateToText());
final Method main = generateFunction();
@@ -163,7 +149,6 @@ public class ControlStructuresTest extends CodegenTestCase {
}
public void testTryFinally() throws Exception {
createEnvironmentWithMockJdk(CompilerSpecialMode.JDK_HEADERS);
loadFile();
// System.out.println(generateToText());
final Method main = generateFunction();
@@ -183,37 +168,30 @@ public class ControlStructuresTest extends CodegenTestCase {
}
public void testForUserType() throws Exception {
createEnvironmentWithMockJdk(CompilerSpecialMode.JDK_HEADERS);
blackBoxFile("controlStructures/forUserType.jet");
}
public void testForIntArray() throws Exception {
createEnvironmentWithMockJdk(CompilerSpecialMode.JDK_HEADERS);
blackBoxFile("controlStructures/forIntArray.jet");
}
public void testForPrimitiveIntArray() throws Exception {
createEnvironmentWithMockJdk(CompilerSpecialMode.JDK_HEADERS);
blackBoxFile("controlStructures/forPrimitiveIntArray.jet");
}
public void testForNullableIntArray() throws Exception {
createEnvironmentWithMockJdk(CompilerSpecialMode.JDK_HEADERS);
blackBoxFile("controlStructures/forNullableIntArray.jet");
}
public void testForIntRange() {
createEnvironmentWithMockJdk(CompilerSpecialMode.JDK_HEADERS);
blackBoxFile("controlStructures/forIntRange.jet");
}
public void testKt237() throws Exception {
createEnvironmentWithMockJdk(CompilerSpecialMode.JDK_HEADERS);
blackBoxFile("regressions/kt237.jet");
}
public void testCompareToNull() throws Exception {
createEnvironmentWithMockJdk(CompilerSpecialMode.JDK_HEADERS);
loadText("fun foo(a: String?, b: String?): Boolean = a == null && b !== null && null == a && null !== b");
String text = generateToText();
assertTrue(!text.contains("java/lang/Object.equals"));
@@ -224,7 +202,6 @@ public class ControlStructuresTest extends CodegenTestCase {
}
public void testCompareToNonnullableEq() throws Exception {
createEnvironmentWithMockJdk(CompilerSpecialMode.JDK_HEADERS);
loadText("fun foo(a: String?, b: String): Boolean = a == b || b == a");
// System.out.println(generateToText());
final Method main = generateFunction();
@@ -233,7 +210,6 @@ public class ControlStructuresTest extends CodegenTestCase {
}
public void testCompareToNonnullableNotEq() throws Exception {
createEnvironmentWithMockJdk(CompilerSpecialMode.JDK_HEADERS);
loadText("fun foo(a: String?, b: String): Boolean = a != b");
String text = generateToText();
// System.out.println(text);
@@ -244,18 +220,15 @@ public class ControlStructuresTest extends CodegenTestCase {
}
public void testKt299() throws Exception {
createEnvironmentWithMockJdk(CompilerSpecialMode.JDK_HEADERS);
blackBoxFile("regressions/kt299.jet");
}
public void testKt416() throws Exception {
createEnvironmentWithMockJdk(CompilerSpecialMode.JDK_HEADERS);
blackBoxFile("regressions/kt416.jet");
// System.out.println(generateToText());
}
public void testKt513() throws Exception {
createEnvironmentWithMockJdk(CompilerSpecialMode.JDK_HEADERS);
blackBoxFile("regressions/kt513.jet");
}
@@ -265,37 +238,31 @@ public class ControlStructuresTest extends CodegenTestCase {
}
public void testKt769() throws Exception {
createEnvironmentWithMockJdk(CompilerSpecialMode.JDK_HEADERS);
blackBoxFile("regressions/kt769.jet");
// System.out.println(generateToText());
}
public void testKt773() throws Exception {
createEnvironmentWithMockJdk(CompilerSpecialMode.JDK_HEADERS);
blackBoxFile("regressions/kt773.jet");
// System.out.println(generateToText());
}
public void testKt772() throws Exception {
createEnvironmentWithMockJdk(CompilerSpecialMode.JDK_HEADERS);
blackBoxFile("regressions/kt772.jet");
// System.out.println(generateToText());
}
public void testKt870() throws Exception {
createEnvironmentWithMockJdk(CompilerSpecialMode.JDK_HEADERS);
blackBoxFile("regressions/kt870.jet");
// System.out.println(generateToText());
}
public void testKt958() throws Exception {
createEnvironmentWithMockJdk(CompilerSpecialMode.JDK_HEADERS);
blackBoxFile("regressions/kt958.jet");
// System.out.println(generateToText());
}
public void testQuicksort() throws Exception {
createEnvironmentWithMockJdk(CompilerSpecialMode.JDK_HEADERS);
blackBoxFile("controlStructures/quicksort.jet");
// System.out.println(generateToText());
}
@@ -313,22 +280,18 @@ public class ControlStructuresTest extends CodegenTestCase {
}
public void testKt1076() throws Exception {
createEnvironmentWithMockJdk(CompilerSpecialMode.JDK_HEADERS);
blackBoxFile("regressions/kt1076.kt");
}
public void testKt998() throws Exception {
createEnvironmentWithMockJdk(CompilerSpecialMode.JDK_HEADERS);
blackBoxFile("regressions/kt998.kt");
}
public void testKt628() throws Exception {
createEnvironmentWithMockJdk(CompilerSpecialMode.JDK_HEADERS);
blackBoxFile("regressions/kt628.kt");
}
public void testKt1441() throws Exception {
createEnvironmentWithMockJdk(CompilerSpecialMode.JDK_HEADERS);
blackBoxFile("regressions/kt1441.kt");
}
}