Migrated CompileJavaAgainstKotlinTest to generated test framework.
This commit is contained in:
+5
-35
@@ -16,10 +16,7 @@
|
||||
|
||||
package org.jetbrains.jet.jvm.compiler;
|
||||
|
||||
import junit.framework.Test;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.ConfigurationKind;
|
||||
import org.jetbrains.jet.JetTestCaseBuilder;
|
||||
import org.jetbrains.jet.JetTestUtils;
|
||||
import org.jetbrains.jet.test.TestCaseWithTmpdir;
|
||||
import org.junit.Assert;
|
||||
@@ -37,26 +34,11 @@ import static org.jetbrains.jet.jvm.compiler.LoadDescriptorUtil.compileKotlinToD
|
||||
* @see WriteSignatureTest
|
||||
*/
|
||||
@SuppressWarnings({"JUnitTestCaseWithNonTrivialConstructors", "JUnitTestCaseWithNoTests"})
|
||||
public class CompileJavaAgainstKotlinTest extends TestCaseWithTmpdir {
|
||||
|
||||
@NotNull
|
||||
private final File ktFile;
|
||||
@NotNull
|
||||
private final File javaFile;
|
||||
|
||||
public CompileJavaAgainstKotlinTest(@NotNull File ktFile) {
|
||||
this.ktFile = ktFile;
|
||||
Assert.assertTrue(ktFile.getName().endsWith(".kt"));
|
||||
this.javaFile = new File(ktFile.getPath().replaceFirst("\\.kt", ".java"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return ktFile.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runTest() throws Throwable {
|
||||
public abstract class AbstractCompileJavaAgainstKotlinTest extends TestCaseWithTmpdir {
|
||||
protected void doTest(String ktFilePath) throws Exception {
|
||||
Assert.assertTrue(ktFilePath.endsWith(".kt"));
|
||||
File ktFile = new File(ktFilePath);
|
||||
File javaFile = new File(ktFilePath.replaceFirst("\\.kt", ".java"));
|
||||
compileKotlinToDirAndGetAnalyzeExhaust(ktFile, tmpdir, getTestRootDisposable(), ConfigurationKind.JDK_ONLY);
|
||||
|
||||
List<String> options = Arrays.asList(
|
||||
@@ -65,16 +47,4 @@ public class CompileJavaAgainstKotlinTest extends TestCaseWithTmpdir {
|
||||
);
|
||||
JetTestUtils.compileJavaFiles(Collections.singleton(javaFile), options);
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
return JetTestCaseBuilder.suiteForDirectory(JetTestCaseBuilder.getTestDataPathBase(), "/compileJavaAgainstKotlin", true, new JetTestCaseBuilder.NamedTestFactory() {
|
||||
@NotNull
|
||||
@Override
|
||||
public Test createTest(@NotNull String dataPath, @NotNull String name, @NotNull File file) {
|
||||
return new CompileJavaAgainstKotlinTest(file);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+170
@@ -0,0 +1,170 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jetbrains.jet.jvm.compiler;
|
||||
|
||||
import junit.framework.Assert;
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import java.io.File;
|
||||
import org.jetbrains.jet.JetTestUtils;
|
||||
import org.jetbrains.jet.test.InnerTestClasses;
|
||||
import org.jetbrains.jet.test.TestMetadata;
|
||||
|
||||
import org.jetbrains.jet.jvm.compiler.AbstractCompileJavaAgainstKotlinTest;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.jet.generators.tests.GenerateTests}. DO NOT MODIFY MANUALLY */
|
||||
@TestMetadata("compiler/testData/compileJavaAgainstKotlin")
|
||||
@InnerTestClasses({CompileJavaAgainstKotlinTestGenerated.Class.class, CompileJavaAgainstKotlinTestGenerated.Method.class})
|
||||
public class CompileJavaAgainstKotlinTestGenerated extends AbstractCompileJavaAgainstKotlinTest {
|
||||
public void testAllFilesPresentInCompileJavaAgainstKotlin() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("compiler/testData/compileJavaAgainstKotlin"), "kt", true);
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/compileJavaAgainstKotlin/class")
|
||||
public static class Class extends AbstractCompileJavaAgainstKotlinTest {
|
||||
public void testAllFilesPresentInClass() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("compiler/testData/compileJavaAgainstKotlin/class"), "kt", true);
|
||||
}
|
||||
|
||||
@TestMetadata("ExtendsAbstractListT.kt")
|
||||
public void testExtendsAbstractListT() throws Exception {
|
||||
doTest("compiler/testData/compileJavaAgainstKotlin/class/ExtendsAbstractListT.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ImplementsListString.kt")
|
||||
public void testImplementsListString() throws Exception {
|
||||
doTest("compiler/testData/compileJavaAgainstKotlin/class/ImplementsListString.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ImplementsMapPP.kt")
|
||||
public void testImplementsMapPP() throws Exception {
|
||||
doTest("compiler/testData/compileJavaAgainstKotlin/class/ImplementsMapPP.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("Simple.kt")
|
||||
public void testSimple() throws Exception {
|
||||
doTest("compiler/testData/compileJavaAgainstKotlin/class/Simple.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/compileJavaAgainstKotlin/method")
|
||||
public static class Method extends AbstractCompileJavaAgainstKotlinTest {
|
||||
public void testAllFilesPresentInMethod() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("compiler/testData/compileJavaAgainstKotlin/method"), "kt", true);
|
||||
}
|
||||
|
||||
@TestMetadata("Any.kt")
|
||||
public void testAny() throws Exception {
|
||||
doTest("compiler/testData/compileJavaAgainstKotlin/method/Any.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ArrayOfIntArray.kt")
|
||||
public void testArrayOfIntArray() throws Exception {
|
||||
doTest("compiler/testData/compileJavaAgainstKotlin/method/ArrayOfIntArray.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ArrayOfIntegerArray.kt")
|
||||
public void testArrayOfIntegerArray() throws Exception {
|
||||
doTest("compiler/testData/compileJavaAgainstKotlin/method/ArrayOfIntegerArray.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("GenericArray.kt")
|
||||
public void testGenericArray() throws Exception {
|
||||
doTest("compiler/testData/compileJavaAgainstKotlin/method/GenericArray.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("Hello.kt")
|
||||
public void testHello() throws Exception {
|
||||
doTest("compiler/testData/compileJavaAgainstKotlin/method/Hello.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("Int.kt")
|
||||
public void testInt() throws Exception {
|
||||
doTest("compiler/testData/compileJavaAgainstKotlin/method/Int.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("IntArray.kt")
|
||||
public void testIntArray() throws Exception {
|
||||
doTest("compiler/testData/compileJavaAgainstKotlin/method/IntArray.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("IntWithDefault.kt")
|
||||
public void testIntWithDefault() throws Exception {
|
||||
doTest("compiler/testData/compileJavaAgainstKotlin/method/IntWithDefault.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("IntegerArray.kt")
|
||||
public void testIntegerArray() throws Exception {
|
||||
doTest("compiler/testData/compileJavaAgainstKotlin/method/IntegerArray.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ListOfInt.kt")
|
||||
public void testListOfInt() throws Exception {
|
||||
doTest("compiler/testData/compileJavaAgainstKotlin/method/ListOfInt.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ListOfString.kt")
|
||||
public void testListOfString() throws Exception {
|
||||
doTest("compiler/testData/compileJavaAgainstKotlin/method/ListOfString.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ListOfT.kt")
|
||||
public void testListOfT() throws Exception {
|
||||
doTest("compiler/testData/compileJavaAgainstKotlin/method/ListOfT.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("MapOfKString.kt")
|
||||
public void testMapOfKString() throws Exception {
|
||||
doTest("compiler/testData/compileJavaAgainstKotlin/method/MapOfKString.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("MapOfStringIntQ.kt")
|
||||
public void testMapOfStringIntQ() throws Exception {
|
||||
doTest("compiler/testData/compileJavaAgainstKotlin/method/MapOfStringIntQ.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("QExtendsListString.kt")
|
||||
public void testQExtendsListString() throws Exception {
|
||||
doTest("compiler/testData/compileJavaAgainstKotlin/method/QExtendsListString.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("QExtendsString.kt")
|
||||
public void testQExtendsString() throws Exception {
|
||||
doTest("compiler/testData/compileJavaAgainstKotlin/method/QExtendsString.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("Vararg.kt")
|
||||
public void testVararg() throws Exception {
|
||||
doTest("compiler/testData/compileJavaAgainstKotlin/method/Vararg.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("Void.kt")
|
||||
public void testVoid() throws Exception {
|
||||
doTest("compiler/testData/compileJavaAgainstKotlin/method/Void.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
TestSuite suite = new TestSuite("CompileJavaAgainstKotlinTestGenerated");
|
||||
suite.addTestSuite(CompileJavaAgainstKotlinTestGenerated.class);
|
||||
suite.addTestSuite(Class.class);
|
||||
suite.addTestSuite(Method.class);
|
||||
return suite;
|
||||
}
|
||||
}
|
||||
@@ -20,25 +20,21 @@ import com.google.common.io.Closeables;
|
||||
import com.google.common.io.Files;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.vfs.CharsetToolkit;
|
||||
import com.intellij.psi.PsiFileFactory;
|
||||
import com.intellij.psi.impl.PsiFileFactoryImpl;
|
||||
import com.intellij.testFramework.LightVirtualFile;
|
||||
import junit.framework.Test;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.asm4.*;
|
||||
import org.jetbrains.asm4.commons.Method;
|
||||
import org.jetbrains.jet.JetTestCaseBuilder;
|
||||
import org.jetbrains.jet.JetTestUtils;
|
||||
import org.jetbrains.jet.cli.jvm.compiler.CompileEnvironmentUtil;
|
||||
import org.jetbrains.jet.cli.jvm.compiler.JetCoreEnvironment;
|
||||
import org.jetbrains.jet.codegen.*;
|
||||
import org.jetbrains.jet.codegen.ClassFileFactory;
|
||||
import org.jetbrains.jet.codegen.GenerationUtils;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.lang.resolve.java.JvmStdlibNames;
|
||||
import org.jetbrains.jet.plugin.JetLanguage;
|
||||
import org.jetbrains.jet.test.TestCaseWithTmpdir;
|
||||
import org.junit.Assert;
|
||||
import org.jetbrains.asm4.commons.Method;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
@@ -53,7 +49,7 @@ import java.util.regex.Pattern;
|
||||
*
|
||||
* @author Stepan Koltsov
|
||||
*
|
||||
* @see CompileJavaAgainstKotlinTest
|
||||
* @see CompileJavaAgainstKotlinTestGenerated
|
||||
*/
|
||||
public class WriteSignatureTest extends TestCaseWithTmpdir {
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ import org.jetbrains.jet.codegen.AbstractIntrinsicsTestCase;
|
||||
import org.jetbrains.jet.codegen.AbstractMultiDeclTestCase;
|
||||
import org.jetbrains.jet.codegen.flags.AbstractWriteFlagsTest;
|
||||
import org.jetbrains.jet.codegen.generated.AbstractCodegenTest;
|
||||
import org.jetbrains.jet.jvm.compiler.AbstractCompileJavaAgainstKotlinTest;
|
||||
import org.jetbrains.jet.jvm.compiler.AbstractLoadCompiledKotlinTest;
|
||||
import org.jetbrains.jet.jvm.compiler.AbstractLoadJavaTest;
|
||||
import org.jetbrains.jet.lang.resolve.lazy.AbstractLazyResolveDescriptorRendererTest;
|
||||
@@ -143,6 +144,13 @@ public class GenerateTests {
|
||||
testModel("compiler/testData/loadJava", true, "java", "doTest")
|
||||
);
|
||||
|
||||
generateTest(
|
||||
"compiler/tests/",
|
||||
"CompileJavaAgainstKotlinTestGenerated",
|
||||
AbstractCompileJavaAgainstKotlinTest.class,
|
||||
testModel("compiler/testData/compileJavaAgainstKotlin", "doTest")
|
||||
);
|
||||
|
||||
generateTest(
|
||||
"compiler/tests/",
|
||||
"LazyResolveDescriptorRendererTestGenerated",
|
||||
|
||||
Reference in New Issue
Block a user