Don't generate test when target backend is not suitable

This commit is contained in:
Zalim Bashorov
2016-11-04 16:44:16 +03:00
parent f382f938c7
commit a1730f98ba
9 changed files with 18 additions and 158 deletions
@@ -936,18 +936,6 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Bridges extends AbstractIrBlackBoxCodegenTest {
@TestMetadata("jsName.kt")
public void ignoredJsName() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/bridges/jsName.kt");
doTest(fileName);
}
@TestMetadata("jsNative.kt")
public void ignoredJsNative() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/bridges/jsNative.kt");
doTest(fileName);
}
public void testAllFilesPresentInBridges() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/bridges"), Pattern.compile("^(.+)\\.kt$"), true);
}
@@ -8841,18 +8829,6 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class LocalClasses extends AbstractIrBlackBoxCodegenTest {
@TestMetadata("closureOfInnerLocalClass.kt")
public void ignoredClosureOfInnerLocalClass() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/localClasses/closureOfInnerLocalClass.kt");
doTest(fileName);
}
@TestMetadata("closureWithSelfInstantiation.kt")
public void ignoredClosureWithSelfInstantiation() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/localClasses/closureWithSelfInstantiation.kt");
doTest(fileName);
}
public void testAllFilesPresentInLocalClasses() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/localClasses"), Pattern.compile("^(.+)\\.kt$"), true);
}
@@ -936,18 +936,6 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Bridges extends AbstractBlackBoxCodegenTest {
@TestMetadata("jsName.kt")
public void ignoredJsName() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/bridges/jsName.kt");
doTest(fileName);
}
@TestMetadata("jsNative.kt")
public void ignoredJsNative() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/bridges/jsNative.kt");
doTest(fileName);
}
public void testAllFilesPresentInBridges() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/bridges"), Pattern.compile("^(.+)\\.kt$"), true);
}
@@ -8841,18 +8829,6 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class LocalClasses extends AbstractBlackBoxCodegenTest {
@TestMetadata("closureOfInnerLocalClass.kt")
public void ignoredClosureOfInnerLocalClass() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/localClasses/closureOfInnerLocalClass.kt");
doTest(fileName);
}
@TestMetadata("closureWithSelfInstantiation.kt")
public void ignoredClosureWithSelfInstantiation() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/localClasses/closureWithSelfInstantiation.kt");
doTest(fileName);
}
public void testAllFilesPresentInLocalClasses() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/localClasses"), Pattern.compile("^(.+)\\.kt$"), true);
}
@@ -234,5 +234,10 @@ public class SimpleTestClassModel implements TestClassModel {
public void generateSignature(@NotNull Printer p) {
TestMethodModel.DefaultImpls.generateSignature(this, p);
}
@Override
public boolean shouldBeGenerated() {
return true;
}
}
}
@@ -117,7 +117,8 @@ public class SimpleTestMethodModel implements TestMethodModel {
}
}
private boolean shouldBeGenerated() {
@Override
public boolean shouldBeGenerated() {
if (targetBackend == TargetBackend.ANY) return true;
List<String> backends = InTextDirectivesUtils.findLinesWithPrefixesRemoved(textWithDirectives(), "// TARGET_BACKEND: ");
@@ -149,7 +150,7 @@ public class SimpleTestMethodModel implements TestMethodModel {
String relativePath = FileUtil.getRelativePath(rootDir, file.getParentFile());
unescapedName = relativePath + "-" + StringUtil.capitalize(extractedName);
}
return (!shouldBeGenerated() ? "ignored" : "test") + StringUtil.capitalize(TestGeneratorUtil.escapeForJavaIdentifier(unescapedName));
return "test" + StringUtil.capitalize(TestGeneratorUtil.escapeForJavaIdentifier(unescapedName));
}
@Override
@@ -160,5 +160,10 @@ public class SingleClassTestModel implements TestClassModel {
public void generateSignature(@NotNull Printer p) {
TestMethodModel.DefaultImpls.generateSignature(this, p);
}
@Override
public boolean shouldBeGenerated() {
return true;
}
}
}
@@ -168,6 +168,9 @@ public class TestGenerator {
for (Iterator<MethodModel> iterator = testMethods.iterator(); iterator.hasNext(); ) {
MethodModel methodModel = iterator.next();
if (!methodModel.shouldBeGenerated()) continue;
generateTestMethod(p, methodModel);
if (iterator.hasNext() || !innerTestClasses.isEmpty()) {
p.println();
@@ -31,6 +31,7 @@ interface TestClassModel : TestEntityModel {
}
interface MethodModel : TestEntityModel {
fun shouldBeGenerated(): Boolean = true
fun generateSignature(p: Printer)
fun generateBody(p: Printer)
}
@@ -31,12 +31,6 @@ import java.util.regex.Pattern;
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public class CommonDecompiledTextFromJsMetadataTestGenerated extends AbstractCommonDecompiledTextFromJsMetadataTest {
@TestMetadata("FlexibleTypes")
public void ignoredFlexibleTypes() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/decompiler/decompiledText/FlexibleTypes/");
doTest(fileName);
}
public void testAllFilesPresentInDecompiledText() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/decompiler/decompiledText"), Pattern.compile("^([^\\.]+)$"), true);
}
@@ -1236,12 +1236,6 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Bridges extends AbstractJsCodegenBoxTest {
@TestMetadata("objectClone.kt")
public void ignoredObjectClone() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/bridges/objectClone.kt");
doTest(fileName);
}
public void testAllFilesPresentInBridges() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/bridges"), Pattern.compile("^(.+)\\.kt$"), true);
}
@@ -3252,18 +3246,6 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Classes extends AbstractJsCodegenBoxTest {
@TestMetadata("classCompanionInitializationWithJava.kt")
public void ignoredClassCompanionInitializationWithJava() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/classes/classCompanionInitializationWithJava.kt");
doTest(fileName);
}
@TestMetadata("interfaceCompanionInitializationWithJava.kt")
public void ignoredInterfaceCompanionInitializationWithJava() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/classes/interfaceCompanionInitializationWithJava.kt");
doTest(fileName);
}
public void testAllFilesPresentInClasses() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/classes"), Pattern.compile("^(.+)\\.kt$"), true);
}
@@ -9410,30 +9392,6 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class InnerNested extends AbstractJsCodegenBoxTest {
@TestMetadata("innerGenericClassFromJava.kt")
public void ignoredInnerGenericClassFromJava() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/innerNested/innerGenericClassFromJava.kt");
doTest(fileName);
}
@TestMetadata("innerJavaClass.kt")
public void ignoredInnerJavaClass() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/innerNested/innerJavaClass.kt");
doTest(fileName);
}
@TestMetadata("protectedNestedClass.kt")
public void ignoredProtectedNestedClass() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/innerNested/protectedNestedClass.kt");
doTest(fileName);
}
@TestMetadata("protectedNestedClassFromJava.kt")
public void ignoredProtectedNestedClassFromJava() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/innerNested/protectedNestedClassFromJava.kt");
doTest(fileName);
}
public void testAllFilesPresentInInnerNested() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/innerNested"), Pattern.compile("^(.+)\\.kt$"), true);
}
@@ -9556,42 +9514,6 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class SuperConstructorCall extends AbstractJsCodegenBoxTest {
@TestMetadata("innerExtendsOuter.kt")
public void ignoredInnerExtendsOuter() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/innerNested/superConstructorCall/innerExtendsOuter.kt");
doTest(fileName);
}
@TestMetadata("localExtendsInner.kt")
public void ignoredLocalExtendsInner() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/innerNested/superConstructorCall/localExtendsInner.kt");
doTest(fileName);
}
@TestMetadata("objectExtendsInner.kt")
public void ignoredObjectExtendsInner() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/innerNested/superConstructorCall/objectExtendsInner.kt");
doTest(fileName);
}
@TestMetadata("objectExtendsInnerDefaultArgument.kt")
public void ignoredObjectExtendsInnerDefaultArgument() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/innerNested/superConstructorCall/objectExtendsInnerDefaultArgument.kt");
doTest(fileName);
}
@TestMetadata("objectExtendsInnerOfLocalVarargAndDefault.kt")
public void ignoredObjectExtendsInnerOfLocalVarargAndDefault() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/innerNested/superConstructorCall/objectExtendsInnerOfLocalVarargAndDefault.kt");
doTest(fileName);
}
@TestMetadata("objectExtendsInnerOfLocalWithCapture.kt")
public void ignoredObjectExtendsInnerOfLocalWithCapture() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/innerNested/superConstructorCall/objectExtendsInnerOfLocalWithCapture.kt");
doTest(fileName);
}
public void testAllFilesPresentInSuperConstructorCall() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/innerNested/superConstructorCall"), Pattern.compile("^(.+)\\.kt$"), true);
}
@@ -19190,30 +19112,6 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class SecondaryConstructors extends AbstractJsCodegenBoxTest {
@TestMetadata("withGenerics.kt")
public void ignoredWithGenerics() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/secondaryConstructors/withGenerics.kt");
doTest(fileName);
}
@TestMetadata("withPrimary.kt")
public void ignoredWithPrimary() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/secondaryConstructors/withPrimary.kt");
doTest(fileName);
}
@TestMetadata("withVarargs.kt")
public void ignoredWithVarargs() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/secondaryConstructors/withVarargs.kt");
doTest(fileName);
}
@TestMetadata("withoutPrimary.kt")
public void ignoredWithoutPrimary() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/secondaryConstructors/withoutPrimary.kt");
doTest(fileName);
}
@TestMetadata("accessToCompanion.kt")
public void testAccessToCompanion() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/secondaryConstructors/accessToCompanion.kt");
@@ -19378,6 +19276,7 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/secondaryConstructors/withReturnUnit.kt");
doTest(fileName);
}
}
@TestMetadata("compiler/testData/codegen/box/smap")