JetLiteFixture: assign to myEnvironment only once
This commit is contained in:
@@ -30,8 +30,10 @@ import com.intellij.testFramework.LightVirtualFile;
|
||||
import com.intellij.testFramework.TestDataFile;
|
||||
import com.intellij.testFramework.UsefulTestCase;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.cli.jvm.compiler.JetCoreEnvironment;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.lang.resolve.java.CompilerSpecialMode;
|
||||
import org.jetbrains.jet.plugin.JetLanguage;
|
||||
|
||||
import java.io.File;
|
||||
@@ -65,14 +67,19 @@ public abstract class JetLiteFixture extends UsefulTestCase {
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
createEnvironmentWithMockJdk();
|
||||
}
|
||||
|
||||
protected void createEnvironmentWithMockJdk() {
|
||||
if (myEnvironment != null) {
|
||||
throw new IllegalStateException("must not set up myEnvironemnt twice");
|
||||
}
|
||||
myEnvironment = JetTestUtils.createEnvironmentWithMockJdk(getTestRootDisposable());
|
||||
}
|
||||
|
||||
protected void createEnvironmentWithFullJdk() {
|
||||
if (myEnvironment != null) {
|
||||
throw new IllegalStateException("must not set up myEnvironemnt twice");
|
||||
}
|
||||
myEnvironment = JetTestUtils.createEnvironmentWithFullJdk(getTestRootDisposable());
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ public class JetControlFlowTest extends JetLiteFixture {
|
||||
static {
|
||||
System.setProperty("idea.platform.prefix", "Idea");
|
||||
}
|
||||
|
||||
|
||||
private String myName;
|
||||
|
||||
public JetControlFlowTest(String dataPath, String name) {
|
||||
@@ -50,6 +50,13 @@ public class JetControlFlowTest extends JetLiteFixture {
|
||||
myName = name;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
createEnvironmentWithMockJdk();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "test" + myName;
|
||||
|
||||
@@ -40,6 +40,13 @@ public class CheckerTestUtilTest extends JetLiteFixture {
|
||||
super("diagnostics/checkerTestUtil");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
createEnvironmentWithMockJdk();
|
||||
}
|
||||
|
||||
|
||||
protected void doTest(TheTest theTest) throws Exception {
|
||||
prepareForTest("test");
|
||||
theTest.test(myFile);
|
||||
|
||||
@@ -54,6 +54,12 @@ public class JetDiagnosticsTest extends JetLiteFixture {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
createEnvironmentWithMockJdk();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "test" + name;
|
||||
|
||||
@@ -24,6 +24,13 @@ import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
public class AnnotationGenTest extends CodegenTestCase {
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
createEnvironmentWithMockJdk();
|
||||
}
|
||||
|
||||
public void testPropField() throws NoSuchFieldException, NoSuchMethodException {
|
||||
loadText("[Deprecated] var x = 0");
|
||||
Class aClass = generateNamespaceClass();
|
||||
|
||||
@@ -19,6 +19,13 @@ package org.jetbrains.jet.codegen;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
public class ArrayGenTest extends CodegenTestCase {
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
createEnvironmentWithMockJdk();
|
||||
}
|
||||
|
||||
public void testKt238 () throws Exception {
|
||||
blackBoxFile("regressions/kt238.jet");
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ package org.jetbrains.jet.codegen;
|
||||
|
||||
public class BridgeMethodGenTest extends CodegenTestCase {
|
||||
public void testBridgeMethod () throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("bridge.jet");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,14 @@ import java.util.List;
|
||||
* @author alex.tkachman
|
||||
*/
|
||||
public class ClassGenTest extends CodegenTestCase {
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
}
|
||||
|
||||
public void testPSVMClass() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
loadFile("classes/simpleClass.jet");
|
||||
|
||||
final Class aClass = loadClass("SimpleClass", generateClassesInFile());
|
||||
@@ -37,6 +44,7 @@ public class ClassGenTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testArrayListInheritance() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
loadFile("classes/inheritingFromArrayList.jet");
|
||||
// System.out.println(generateToText());
|
||||
final Class aClass = loadClass("Foo", generateClassesInFile());
|
||||
@@ -44,30 +52,37 @@ public class ClassGenTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testInheritanceAndDelegation_DelegatingDefaultConstructorProperties() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("classes/inheritance.jet");
|
||||
}
|
||||
|
||||
public void testInheritanceAndDelegation2() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("classes/delegation2.kt");
|
||||
}
|
||||
|
||||
public void testFunDelegation() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("classes/funDelegation.jet");
|
||||
}
|
||||
|
||||
public void testPropertyDelegation() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("classes/propertyDelegation.jet");
|
||||
}
|
||||
|
||||
public void testDiamondInheritance() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("classes/diamondInheritance.jet");
|
||||
}
|
||||
|
||||
public void testRightHandOverride() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("classes/rightHandOverride.jet");
|
||||
}
|
||||
|
||||
public void testNewInstanceExplicitConstructor() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
loadFile("classes/newInstanceDefaultConstructor.jet");
|
||||
// System.out.println(generateToText());
|
||||
final Method method = generateFunction("test");
|
||||
@@ -76,18 +91,22 @@ public class ClassGenTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testInnerClass() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("classes/innerClass.jet");
|
||||
}
|
||||
|
||||
public void testInheritedInnerClass() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("classes/inheritedInnerClass.jet");
|
||||
}
|
||||
|
||||
public void testInitializerBlock() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("classes/initializerBlock.jet");
|
||||
}
|
||||
|
||||
public void testAbstractMethod() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
loadText("abstract class Foo { abstract fun x(): String; fun y(): Int = 0 }");
|
||||
|
||||
final ClassFileFactory codegens = generateClassesInFile();
|
||||
@@ -97,34 +116,42 @@ public class ClassGenTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testInheritedMethod() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("classes/inheritedMethod.jet");
|
||||
}
|
||||
|
||||
public void testInitializerBlockDImpl() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("classes/initializerBlockDImpl.jet");
|
||||
}
|
||||
|
||||
public void testPropertyInInitializer() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("classes/propertyInInitializer.jet");
|
||||
}
|
||||
|
||||
public void testOuterThis() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("classes/outerThis.jet");
|
||||
}
|
||||
|
||||
public void testSecondaryConstructors() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("classes/secondaryConstructors.jet");
|
||||
}
|
||||
|
||||
public void testExceptionConstructor() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("classes/exceptionConstructor.jet");
|
||||
}
|
||||
|
||||
public void testSimpleBox() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("classes/simpleBox.jet");
|
||||
}
|
||||
|
||||
public void testAbstractClass() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
loadText("abstract class SimpleClass() { }");
|
||||
|
||||
final Class aClass = createClassLoader(generateClassesInFile()).loadClass("SimpleClass");
|
||||
@@ -132,15 +159,18 @@ public class ClassGenTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testClassObject() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("classes/classObject.jet");
|
||||
}
|
||||
|
||||
public void testClassObjectMethod() throws Exception {
|
||||
// todo to be implemented after removal of type info
|
||||
createEnvironmentWithMockJdk();
|
||||
// todo to be implemented after removal of type info
|
||||
// blackBoxFile("classes/classObjectMethod.jet");
|
||||
}
|
||||
|
||||
public void testClassObjectInterface() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
loadFile("classes/classObjectInterface.jet");
|
||||
final Method method = generateFunction();
|
||||
Object result = method.invoke(null);
|
||||
@@ -148,26 +178,32 @@ public class ClassGenTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testOverloadBinaryOperator() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("classes/overloadBinaryOperator.jet");
|
||||
}
|
||||
|
||||
public void testOverloadUnaryOperator() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("classes/overloadUnaryOperator.jet");
|
||||
}
|
||||
|
||||
public void testOverloadPlusAssign() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("classes/overloadPlusAssign.jet");
|
||||
}
|
||||
|
||||
public void testOverloadPlusAssignReturn() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("classes/overloadPlusAssignReturn.jet");
|
||||
}
|
||||
|
||||
public void testOverloadPlusToPlusAssign() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("classes/overloadPlusToPlusAssign.jet");
|
||||
}
|
||||
|
||||
public void testEnumClass() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
loadText("enum class Direction { NORTH; SOUTH; EAST; WEST }");
|
||||
final Class direction = createClassLoader(generateClassesInFile()).loadClass("Direction");
|
||||
// System.out.println(generateToText());
|
||||
@@ -177,6 +213,7 @@ public class ClassGenTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testEnumConstantConstructors() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
loadText("enum class Color(val rgb: Int) { RED: Color(0xFF0000); GREEN: Color(0x00FF00); }");
|
||||
final Class colorClass = createClassLoader(generateClassesInFile()).loadClass("Color");
|
||||
final Field redField = colorClass.getField("RED");
|
||||
@@ -186,21 +223,25 @@ public class ClassGenTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testClassObjFields() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
loadText("class A() { class object { val value = 10 } }\n" +
|
||||
"fun box() = if(A.value == 10) \"OK\" else \"fail\"");
|
||||
blackBox();
|
||||
}
|
||||
|
||||
public void testKt249() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("regressions/kt249.jet");
|
||||
}
|
||||
|
||||
public void testKt48 () throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("regressions/kt48.jet");
|
||||
// System.out.println(generateToText());
|
||||
}
|
||||
|
||||
public void testKt309 () throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
loadText("fun box() = null");
|
||||
final Method method = generateFunction("box");
|
||||
assertEquals(method.getReturnType().getName(), "java.lang.Object");
|
||||
@@ -208,65 +249,78 @@ public class ClassGenTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testKt343 () throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("regressions/kt343.jet");
|
||||
// System.out.println(generateToText());
|
||||
}
|
||||
|
||||
public void testKt508 () throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
loadFile("regressions/kt508.jet");
|
||||
// System.out.println(generateToText());
|
||||
blackBox();
|
||||
}
|
||||
|
||||
public void testKt504 () throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
loadFile("regressions/kt504.jet");
|
||||
// System.out.println(generateToText());
|
||||
blackBox();
|
||||
}
|
||||
|
||||
public void testKt501 () throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("regressions/kt501.jet");
|
||||
}
|
||||
|
||||
public void testKt496 () throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("regressions/kt496.jet");
|
||||
// System.out.println(generateToText());
|
||||
}
|
||||
|
||||
public void testKt500 () throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("regressions/kt500.jet");
|
||||
}
|
||||
|
||||
public void testKt694 () throws Exception {
|
||||
// blackBoxFile("regressions/kt694.jet");
|
||||
createEnvironmentWithMockJdk();
|
||||
// blackBoxFile("regressions/kt694.jet");
|
||||
}
|
||||
|
||||
public void testKt285 () throws Exception {
|
||||
// blackBoxFile("regressions/kt285.jet");
|
||||
createEnvironmentWithMockJdk();
|
||||
// blackBoxFile("regressions/kt285.jet");
|
||||
}
|
||||
|
||||
public void testKt707 () throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("regressions/kt707.jet");
|
||||
}
|
||||
|
||||
public void testKt857 () throws Exception {
|
||||
// blackBoxFile("regressions/kt857.jet");
|
||||
createEnvironmentWithMockJdk();
|
||||
// blackBoxFile("regressions/kt857.jet");
|
||||
}
|
||||
|
||||
public void testKt903 () throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("regressions/kt903.jet");
|
||||
}
|
||||
|
||||
public void testKt940 () throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("regressions/kt940.kt");
|
||||
}
|
||||
|
||||
public void testKt1018 () throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("regressions/kt1018.kt");
|
||||
}
|
||||
|
||||
public void testKt1120 () throws Exception {
|
||||
// createEnvironmentWithFullJdk();
|
||||
createEnvironmentWithFullJdk();
|
||||
// blackBoxFile("regressions/kt1120.kt");
|
||||
}
|
||||
|
||||
@@ -276,47 +330,58 @@ public class ClassGenTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testKt1134() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("regressions/kt1134.kt");
|
||||
}
|
||||
|
||||
public void testKt1157() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("regressions/kt1157.kt");
|
||||
}
|
||||
|
||||
public void testKt471() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("regressions/kt471.kt");
|
||||
}
|
||||
|
||||
public void testKt1213() throws Exception {
|
||||
// blackBoxFile("regressions/kt1213.kt");
|
||||
createEnvironmentWithMockJdk();
|
||||
// blackBoxFile("regressions/kt1213.kt");
|
||||
}
|
||||
|
||||
public void testKt723() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("regressions/kt723.kt");
|
||||
}
|
||||
|
||||
public void testKt725() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("regressions/kt725.kt");
|
||||
}
|
||||
|
||||
public void testKt633() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("regressions/kt633.kt");
|
||||
}
|
||||
|
||||
|
||||
public void testKt1345() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("regressions/kt1345.kt");
|
||||
}
|
||||
|
||||
public void testKt1538() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("regressions/kt1538.kt");
|
||||
}
|
||||
|
||||
public void testKt1759() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("regressions/kt1759.kt");
|
||||
}
|
||||
|
||||
public void testResolveOrder() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("classes/resolveOrder.jet");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,13 @@ package org.jetbrains.jet.codegen;
|
||||
* @author max
|
||||
*/
|
||||
public class ClosuresGenTest extends CodegenTestCase {
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
createEnvironmentWithMockJdk();
|
||||
}
|
||||
|
||||
public void testSimplestClosure() throws Exception {
|
||||
blackBoxFile("classes/simplestClosure.jet");
|
||||
// System.out.println(generateToText());
|
||||
|
||||
@@ -24,6 +24,7 @@ import org.jetbrains.jet.analyzer.AnalyzeExhaust;
|
||||
import org.jetbrains.jet.lang.cfg.pseudocode.JetControlFlowDataTraceFactory;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.lang.psi.JetPsiUtil;
|
||||
import org.jetbrains.jet.lang.resolve.AnalyzingUtils;
|
||||
import org.jetbrains.jet.lang.resolve.java.AnalyzerFacadeForJVM;
|
||||
import org.jetbrains.jet.lang.resolve.java.CompilerSpecialMode;
|
||||
import org.jetbrains.jet.parsing.JetParsingTest;
|
||||
|
||||
@@ -30,6 +30,7 @@ import java.lang.reflect.Method;
|
||||
|
||||
public class CompileTextTest extends CodegenTestCase {
|
||||
public void testMe() throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException {
|
||||
createEnvironmentWithMockJdk();
|
||||
String text = "import org.jetbrains.jet.codegen.CompileTextTest; fun x() = CompileTextTest()";
|
||||
CompilerDependencies dependencies = CompileCompilerDependenciesTest.compilerDependenciesForTests(CompilerSpecialMode.REGULAR, false);
|
||||
JetCoreEnvironment environment = new JetCoreEnvironment(CompileEnvironmentUtil.createMockDisposable(), dependencies);
|
||||
|
||||
@@ -31,6 +31,7 @@ public class ControlStructuresTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testIf() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
loadFile();
|
||||
|
||||
// System.out.println(generateToText());
|
||||
@@ -40,6 +41,7 @@ public class ControlStructuresTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testSingleBranchIf() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
loadFile();
|
||||
|
||||
// System.out.println(generateToText());
|
||||
@@ -61,6 +63,7 @@ public class ControlStructuresTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
private void factorialTest(final String name) throws IllegalAccessException, InvocationTargetException {
|
||||
createEnvironmentWithMockJdk();
|
||||
loadFile(name);
|
||||
|
||||
// System.out.println(generateToText());
|
||||
@@ -70,6 +73,7 @@ public class ControlStructuresTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testContinue() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
loadFile();
|
||||
// System.out.println(generateToText());
|
||||
final Method main = generateFunction();
|
||||
@@ -78,6 +82,7 @@ public class ControlStructuresTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testIfNoElse() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
loadFile();
|
||||
// System.out.println(generateToText());
|
||||
final Method main = generateFunction();
|
||||
@@ -86,6 +91,7 @@ public class ControlStructuresTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testCondJumpOnStack() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
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"));
|
||||
@@ -93,6 +99,7 @@ public class ControlStructuresTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testFor() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
loadFile();
|
||||
// System.out.println(generateToText());
|
||||
final Method main = generateFunction();
|
||||
@@ -101,6 +108,7 @@ public class ControlStructuresTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testIfBlock() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
loadFile();
|
||||
// System.out.println(generateToText());
|
||||
final Method main = generateFunction();
|
||||
@@ -111,6 +119,7 @@ public class ControlStructuresTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testForInArray() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
loadFile();
|
||||
// System.out.println(generateToText());
|
||||
final Method main = generateFunction();
|
||||
@@ -119,6 +128,7 @@ public class ControlStructuresTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testForInRange() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
loadText("fun foo(sb: StringBuilder) { for(x in 1..4) sb.append(x) }");
|
||||
final Method main = generateFunction();
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
@@ -127,6 +137,7 @@ public class ControlStructuresTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testThrowCheckedException() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
loadText("fun foo() { throw Exception(); }");
|
||||
final Method main = generateFunction();
|
||||
boolean caught = false;
|
||||
@@ -141,6 +152,7 @@ public class ControlStructuresTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testTryCatch() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
loadFile();
|
||||
// System.out.println(generateToText());
|
||||
final Method main = generateFunction();
|
||||
@@ -149,6 +161,7 @@ public class ControlStructuresTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testTryFinally() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
loadFile();
|
||||
// System.out.println(generateToText());
|
||||
final Method main = generateFunction();
|
||||
@@ -168,30 +181,37 @@ public class ControlStructuresTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testForUserType() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("controlStructures/forUserType.jet");
|
||||
}
|
||||
|
||||
public void testForIntArray() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("controlStructures/forIntArray.jet");
|
||||
}
|
||||
|
||||
public void testForPrimitiveIntArray() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("controlStructures/forPrimitiveIntArray.jet");
|
||||
}
|
||||
|
||||
public void testForNullableIntArray() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("controlStructures/forNullableIntArray.jet");
|
||||
}
|
||||
|
||||
public void testForIntRange() {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("controlStructures/forIntRange.jet");
|
||||
}
|
||||
|
||||
public void testKt237() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("regressions/kt237.jet");
|
||||
}
|
||||
|
||||
public void testCompareToNull() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
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"));
|
||||
@@ -202,6 +222,7 @@ public class ControlStructuresTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testCompareToNonnullableEq() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
loadText("fun foo(a: String?, b: String): Boolean = a == b || b == a");
|
||||
// System.out.println(generateToText());
|
||||
final Method main = generateFunction();
|
||||
@@ -210,6 +231,7 @@ public class ControlStructuresTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testCompareToNonnullableNotEq() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
loadText("fun foo(a: String?, b: String): Boolean = a != b");
|
||||
String text = generateToText();
|
||||
// System.out.println(text);
|
||||
@@ -220,15 +242,18 @@ public class ControlStructuresTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testKt299() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("regressions/kt299.jet");
|
||||
}
|
||||
|
||||
public void testKt416() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("regressions/kt416.jet");
|
||||
// System.out.println(generateToText());
|
||||
}
|
||||
|
||||
public void testKt513() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("regressions/kt513.jet");
|
||||
}
|
||||
|
||||
@@ -238,31 +263,37 @@ public class ControlStructuresTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testKt769() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("regressions/kt769.jet");
|
||||
// System.out.println(generateToText());
|
||||
}
|
||||
|
||||
public void testKt773() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("regressions/kt773.jet");
|
||||
// System.out.println(generateToText());
|
||||
}
|
||||
|
||||
public void testKt772() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("regressions/kt772.jet");
|
||||
// System.out.println(generateToText());
|
||||
}
|
||||
|
||||
public void testKt870() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("regressions/kt870.jet");
|
||||
// System.out.println(generateToText());
|
||||
}
|
||||
|
||||
public void testKt958() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("regressions/kt958.jet");
|
||||
// System.out.println(generateToText());
|
||||
}
|
||||
|
||||
public void testQuicksort() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("controlStructures/quicksort.jet");
|
||||
// System.out.println(generateToText());
|
||||
}
|
||||
@@ -280,18 +311,22 @@ public class ControlStructuresTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testKt1076() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("regressions/kt1076.kt");
|
||||
}
|
||||
|
||||
public void testKt998() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("regressions/kt998.kt");
|
||||
}
|
||||
|
||||
public void testKt628() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("regressions/kt628.kt");
|
||||
}
|
||||
|
||||
public void testKt1441() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("regressions/kt1441.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ public class ExtensionFunctionsTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testSimple() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
loadFile();
|
||||
final Method foo = generateFunction("foo");
|
||||
final Character c = (Character) foo.invoke(null);
|
||||
@@ -36,6 +37,7 @@ public class ExtensionFunctionsTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testWhenFail() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
loadFile();
|
||||
// System.out.println(generateToText());
|
||||
Method foo = generateFunction("foo");
|
||||
@@ -43,15 +45,18 @@ public class ExtensionFunctionsTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testVirtual() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("extensionFunctions/virtual.jet");
|
||||
}
|
||||
|
||||
public void testShared() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("extensionFunctions/shared.kt");
|
||||
// System.out.println(generateToText());
|
||||
}
|
||||
|
||||
public void testKt475() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("regressions/kt475.jet");
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,12 @@ import java.lang.reflect.Method;
|
||||
* @author alex.tkachman
|
||||
*/
|
||||
public class FunctionGenTest extends CodegenTestCase {
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
createEnvironmentWithMockJdk();
|
||||
}
|
||||
|
||||
public void testDefaultArgs() throws Exception {
|
||||
blackBoxFile("functions/defaultargs.jet");
|
||||
// System.out.println(generateToText());
|
||||
|
||||
@@ -30,6 +30,13 @@ import java.util.Arrays;
|
||||
* @author yole
|
||||
*/
|
||||
public class NamespaceGenTest extends CodegenTestCase {
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
createEnvironmentWithMockJdk();
|
||||
}
|
||||
|
||||
public void testPSVM() throws Exception {
|
||||
loadFile("PSVM.jet");
|
||||
// System.out.println(generateToText());
|
||||
|
||||
@@ -21,6 +21,12 @@ package org.jetbrains.jet.codegen;
|
||||
* @author alex.tkachman
|
||||
*/
|
||||
public class ObjectGenTest extends CodegenTestCase {
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
createEnvironmentWithMockJdk();
|
||||
}
|
||||
|
||||
public void testSimpleObject() throws Exception {
|
||||
blackBoxFile("objects/simpleObject.jet");
|
||||
// System.out.println(generateToText());
|
||||
|
||||
@@ -24,6 +24,13 @@ import java.lang.reflect.Method;
|
||||
* @author yole
|
||||
*/
|
||||
public class PatternMatchingTest extends CodegenTestCase {
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
createEnvironmentWithMockJdk();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getPrefix() {
|
||||
return "patternMatching";
|
||||
|
||||
@@ -23,6 +23,13 @@ import java.lang.reflect.Method;
|
||||
* @author alex.tkachman
|
||||
*/
|
||||
public class PrimitiveTypesTest extends CodegenTestCase {
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
createEnvironmentWithMockJdk();
|
||||
}
|
||||
|
||||
public void testPlus() throws Exception {
|
||||
loadText("fun f(a: Int, b: Int): Int { return a + b }");
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ public class PropertyGenTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testPrivateVal() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
loadFile();
|
||||
final Class aClass = loadImplementationClass(generateClassesInFile(), "PrivateVal");
|
||||
final Field[] fields = aClass.getDeclaredFields();
|
||||
@@ -40,6 +41,7 @@ public class PropertyGenTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testPrivateVar() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
loadFile();
|
||||
final Class aClass = loadImplementationClass(generateClassesInFile(), "PrivateVar");
|
||||
final Object instance = aClass.newInstance();
|
||||
@@ -50,6 +52,7 @@ public class PropertyGenTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testPublicVar() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
loadText("class PublicVar() { public var foo : Int = 0; }");
|
||||
final Class aClass = loadImplementationClass(generateClassesInFile(), "PublicVar");
|
||||
final Object instance = aClass.newInstance();
|
||||
@@ -60,6 +63,7 @@ public class PropertyGenTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testAccessorsInInterface() {
|
||||
createEnvironmentWithMockJdk();
|
||||
loadText("class AccessorsInInterface() { public var foo : Int = 0; }");
|
||||
final Class aClass = loadClass("AccessorsInInterface", generateClassesInFile());
|
||||
assertNotNull(findMethodByName(aClass, "getFoo"));
|
||||
@@ -67,6 +71,7 @@ public class PropertyGenTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testPrivatePropertyInNamespace() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
loadText("private val x = 239");
|
||||
final Class nsClass = generateNamespaceClass();
|
||||
final Field[] fields = nsClass.getDeclaredFields();
|
||||
@@ -79,6 +84,7 @@ public class PropertyGenTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testFieldPropertyAccess() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
loadFile("properties/fieldPropertyAccess.jet");
|
||||
// System.out.println(generateToText());
|
||||
final Method method = generateFunction();
|
||||
@@ -87,12 +93,14 @@ public class PropertyGenTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testFieldGetter() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
loadText("val now: Long get() = System.currentTimeMillis(); fun foo() = now");
|
||||
final Method method = generateFunction("foo");
|
||||
assertIsCurrentTime((Long) method.invoke(null));
|
||||
}
|
||||
|
||||
public void testFieldSetter() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
loadFile();
|
||||
final Method method = generateFunction("append");
|
||||
method.invoke(null, "IntelliJ ");
|
||||
@@ -104,6 +112,7 @@ public class PropertyGenTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testFieldSetterPlusEq() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
loadFile();
|
||||
final Method method = generateFunction("append");
|
||||
method.invoke(null, "IntelliJ ");
|
||||
@@ -112,6 +121,7 @@ public class PropertyGenTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testAccessorsWithoutBody() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
loadText("class AccessorsWithoutBody() { protected var foo: Int = 349\n get\n private set\n fun setter() { foo = 610; } } ");
|
||||
// System.out.println(generateToText());
|
||||
final Class aClass = loadImplementationClass(generateClassesInFile(), "AccessorsWithoutBody");
|
||||
@@ -129,6 +139,7 @@ public class PropertyGenTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testInitializersForNamespaceProperties() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
loadText("val x = System.currentTimeMillis()");
|
||||
final Method method = generateFunction("getX");
|
||||
method.setAccessible(true);
|
||||
@@ -136,6 +147,7 @@ public class PropertyGenTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testPropertyReceiverOnStack() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
loadFile();
|
||||
final Class aClass = loadImplementationClass(generateClassesInFile(), "Evaluator");
|
||||
final Constructor constructor = aClass.getConstructor(StringBuilder.class);
|
||||
@@ -147,6 +159,7 @@ public class PropertyGenTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testAbstractVal() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
loadText("abstract class Foo { public abstract val x: String }");
|
||||
final ClassFileFactory codegens = generateClassesInFile();
|
||||
final Class aClass = loadClass("Foo", codegens);
|
||||
@@ -154,6 +167,7 @@ public class PropertyGenTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testVolatileProperty() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
loadText("abstract class Foo { public volatile var x: String = \"\"; }");
|
||||
// System.out.println(generateToText());
|
||||
final ClassFileFactory codegens = generateClassesInFile();
|
||||
@@ -163,15 +177,18 @@ public class PropertyGenTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testKt257 () throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("regressions/kt257.jet");
|
||||
// System.out.println(generateToText());
|
||||
}
|
||||
|
||||
public void testKt613 () throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("regressions/kt613.jet");
|
||||
}
|
||||
|
||||
public void testKt160() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
loadText("internal val s = java.lang.Double.toString(1.0)");
|
||||
final Method method = generateFunction("getS");
|
||||
method.setAccessible(true);
|
||||
@@ -179,10 +196,12 @@ public class PropertyGenTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testKt1165() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("regressions/kt1165.kt");
|
||||
}
|
||||
|
||||
public void testKt1168() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("regressions/kt1168.kt");
|
||||
}
|
||||
|
||||
@@ -192,14 +211,17 @@ public class PropertyGenTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testKt1159() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("regressions/kt1159.kt");
|
||||
}
|
||||
|
||||
public void testKt1417() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("regressions/kt1417.kt");
|
||||
}
|
||||
|
||||
public void testKt1398() throws Exception {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("regressions/kt1398.kt");
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,12 @@
|
||||
package org.jetbrains.jet.codegen;
|
||||
|
||||
public class SafeRefTest extends CodegenTestCase {
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
createEnvironmentWithMockJdk();
|
||||
}
|
||||
|
||||
public void test247 () throws Exception {
|
||||
blackBoxFile("regressions/kt247.jet");
|
||||
}
|
||||
|
||||
@@ -25,6 +25,12 @@ import java.lang.reflect.Method;
|
||||
*/
|
||||
public class StringsTest extends CodegenTestCase {
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
createEnvironmentWithMockJdk();
|
||||
}
|
||||
|
||||
public void testAnyToString () throws InvocationTargetException, IllegalAccessException {
|
||||
loadText("fun foo(x: Any) = x.toString()");
|
||||
// System.out.println(generateToText());
|
||||
|
||||
@@ -17,6 +17,13 @@
|
||||
package org.jetbrains.jet.codegen;
|
||||
|
||||
public class SuperGenTest extends CodegenTestCase {
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
createEnvironmentWithMockJdk();
|
||||
}
|
||||
|
||||
public void testBasicProperty () {
|
||||
blackBoxFile("/super/basicproperty.jet");
|
||||
// System.out.println(generateToText());
|
||||
|
||||
@@ -17,6 +17,13 @@
|
||||
package org.jetbrains.jet.codegen;
|
||||
|
||||
public class TraitsTest extends CodegenTestCase {
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
createEnvironmentWithMockJdk();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getPrefix() {
|
||||
return "traits";
|
||||
|
||||
@@ -18,6 +18,7 @@ package org.jetbrains.jet.codegen;
|
||||
|
||||
public class TupleGenTest extends CodegenTestCase {
|
||||
public void testBasic() {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("/tuples/basic.jet");
|
||||
// System.out.println(generateToText());
|
||||
}
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
|
||||
package org.jetbrains.jet.codegen;
|
||||
|
||||
import jet.TypeCastException;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/**
|
||||
@@ -25,6 +23,13 @@ import java.lang.reflect.Method;
|
||||
* @author alex.tkachman
|
||||
*/
|
||||
public class TypeInfoTest extends CodegenTestCase {
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
createEnvironmentWithMockJdk();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getPrefix() {
|
||||
return "typeInfo";
|
||||
|
||||
@@ -19,13 +19,13 @@ package org.jetbrains.jet.codegen;
|
||||
import java.lang.reflect.Array;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* @author alex.tkachman
|
||||
*/
|
||||
public class VarArgTest extends CodegenTestCase {
|
||||
public void testStringArray () throws InvocationTargetException, IllegalAccessException {
|
||||
createEnvironmentWithMockJdk();
|
||||
loadText("fun test(vararg ts: String) = ts");
|
||||
// System.out.println(generateToText());
|
||||
final Method main = generateFunction();
|
||||
@@ -34,6 +34,7 @@ public class VarArgTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testIntArray () throws InvocationTargetException, IllegalAccessException {
|
||||
createEnvironmentWithMockJdk();
|
||||
loadText("fun test(vararg ts: Int) = ts");
|
||||
// System.out.println(generateToText());
|
||||
final Method main = generateFunction();
|
||||
@@ -42,6 +43,7 @@ public class VarArgTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testIntArrayKotlinNoArgs () throws InvocationTargetException, IllegalAccessException {
|
||||
createEnvironmentWithMockJdk();
|
||||
loadText("fun test() = testf(); fun testf(vararg ts: Int) = ts");
|
||||
// System.out.println(generateToText());
|
||||
final Method main = generateFunction("test");
|
||||
@@ -50,6 +52,7 @@ public class VarArgTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testIntArrayKotlin () throws InvocationTargetException, IllegalAccessException {
|
||||
createEnvironmentWithMockJdk();
|
||||
loadText("fun test() = testf(239, 7); fun testf(vararg ts: Int) = ts");
|
||||
// System.out.println(generateToText());
|
||||
final Method main = generateFunction("test");
|
||||
@@ -60,6 +63,7 @@ public class VarArgTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testNullableIntArrayKotlin () throws InvocationTargetException, IllegalAccessException {
|
||||
createEnvironmentWithMockJdk();
|
||||
loadText("fun test() = testf(239.toByte(), 7.toByte()); fun testf(vararg ts: Byte?) = ts");
|
||||
// System.out.println(generateToText());
|
||||
final Method main = generateFunction("test");
|
||||
@@ -70,6 +74,7 @@ public class VarArgTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testIntArrayKotlinObj () throws InvocationTargetException, IllegalAccessException {
|
||||
createEnvironmentWithMockJdk();
|
||||
loadText("fun test() = testf(\"239\"); fun testf(vararg ts: String) = ts");
|
||||
// System.out.println(generateToText());
|
||||
final Method main = generateFunction("test");
|
||||
@@ -79,6 +84,7 @@ public class VarArgTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testArrayT () throws InvocationTargetException, IllegalAccessException {
|
||||
createEnvironmentWithMockJdk();
|
||||
loadText("fun test() = _array(2, 4); fun <T> _array(vararg elements : T) = elements");
|
||||
// System.out.println(generateToText());
|
||||
final Method main = generateFunction("test");
|
||||
@@ -94,10 +100,12 @@ public class VarArgTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testKt797() {
|
||||
createEnvironmentWithMockJdk();
|
||||
blackBoxFile("regressions/kt796_797.jet");
|
||||
}
|
||||
|
||||
public void testArrayAsVararg () throws InvocationTargetException, IllegalAccessException {
|
||||
createEnvironmentWithMockJdk();
|
||||
loadText("private fun asList(vararg elems: String) = elems; fun test(ts: Array<String>) = asList(*ts); ");
|
||||
//System.out.println(generateToText());
|
||||
final Method main = generateFunction("test");
|
||||
@@ -106,6 +114,7 @@ public class VarArgTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testArrayAsVararg2 () throws InvocationTargetException, IllegalAccessException {
|
||||
createEnvironmentWithMockJdk();
|
||||
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");
|
||||
|
||||
@@ -41,6 +41,14 @@ import java.util.List;
|
||||
* @since 4/6/12
|
||||
*/
|
||||
public class DescriptorRendererTest extends JetLiteFixture {
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
createEnvironmentWithMockJdk();
|
||||
}
|
||||
|
||||
|
||||
public void testGlobalProperties() throws IOException {
|
||||
doTest();
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.CompileCompilerDependenciesTest;
|
||||
import org.jetbrains.jet.analyzer.AnalyzeExhaust;
|
||||
import org.jetbrains.jet.cli.jvm.compiler.JetCoreEnvironment;
|
||||
import org.jetbrains.jet.lang.cfg.pseudocode.JetControlFlowDataTraceFactory;
|
||||
import org.jetbrains.jet.lang.descriptors.*;
|
||||
import org.jetbrains.jet.lang.diagnostics.Diagnostic;
|
||||
|
||||
@@ -32,6 +32,9 @@ public abstract class ExtensibleResolveTestCase extends JetLiteFixture {
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
|
||||
createEnvironmentWithMockJdk();
|
||||
|
||||
expectedResolveData = getExpectedResolveData();
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,14 @@ import org.jetbrains.jet.codegen.CodegenTestCase;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
public class JetNpeTest extends CodegenTestCase {
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
createEnvironmentWithMockJdk();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void testStackTrace () {
|
||||
try {
|
||||
Intrinsics.throwNpe();
|
||||
|
||||
@@ -45,6 +45,7 @@ public class JetDefaultModalityModifiersTest extends JetLiteFixture {
|
||||
@Override
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
super.createEnvironmentWithMockJdk();
|
||||
tc.setUp();
|
||||
}
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ public class JetOverloadTest extends JetLiteFixture {
|
||||
@Override
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
createEnvironmentWithMockJdk();
|
||||
InjectorForTests injector = new InjectorForTests(getProject());
|
||||
library = injector.getJetStandardLibrary();
|
||||
descriptorResolver = injector.getDescriptorResolver();
|
||||
|
||||
@@ -40,6 +40,7 @@ public class JetOverridingTest extends JetLiteFixture {
|
||||
@Override
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
createEnvironmentWithMockJdk();
|
||||
InjectorForTests injector = new InjectorForTests(getProject());
|
||||
library = injector.getJetStandardLibrary();
|
||||
descriptorResolver = injector.getDescriptorResolver();
|
||||
|
||||
@@ -66,6 +66,9 @@ public class JetTypeCheckerTest extends JetLiteFixture {
|
||||
@Override
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
|
||||
super.createEnvironmentWithMockJdk();
|
||||
|
||||
library = JetStandardLibrary.getInstance();
|
||||
classDefinitions = new ClassDefinitions();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user