From 383e273fedb8a7a6d21bb32e2fbda55d440f1ed2 Mon Sep 17 00:00:00 2001 From: Alexey Andreev Date: Fri, 26 May 2017 14:58:29 +0300 Subject: [PATCH] In LightAnalysisModeTestGenerated skip tests ignored in JVM When a test is marked as ignored in JVM BE (i.e. IGNORE_BACKEND: JVM) it's ignored in LightAnalysisModeTestGenerated. This means that this tests is expected to fail. However, often tests that fail in JVM blackbox tests, don't fail in LAMTG, therefore it's reasonable to skip these tests in LAMTG at all. --- .../box/defaultArguments/implementedByFake.kt | 4 +- .../localClasses/closureOfInnerLocalClass.kt | 2 +- .../closureWithSelfInstantiation.kt | 2 +- .../augmentedAssignmentsAndIncrements.kt | 2 +- .../ir/IrBlackBoxCodegenTestGenerated.java | 48 +++++++++++ .../codegen/BlackBoxCodegenTestGenerated.java | 48 +++++++++++ .../LightAnalysisModeTestGenerated.java | 82 +++++++++++++++---- .../kotlin/generators/tests/GenerateTests.kt | 10 ++- .../tests/generator/SimpleTestClassModel.java | 14 +++- .../generator/SimpleTestMethodModel.java | 11 ++- .../tests/generator/SingleClassTestModel.java | 8 +- 11 files changed, 196 insertions(+), 35 deletions(-) diff --git a/compiler/testData/codegen/box/defaultArguments/implementedByFake.kt b/compiler/testData/codegen/box/defaultArguments/implementedByFake.kt index d5c4564cbac..b29a016f166 100644 --- a/compiler/testData/codegen/box/defaultArguments/implementedByFake.kt +++ b/compiler/testData/codegen/box/defaultArguments/implementedByFake.kt @@ -1,6 +1,4 @@ -// TARGET_BACKEND: JS -// This test causes JVM to generate incorrect bytecode -// Could not use IGNORE_BACKEND directive, since it makes LightAnalysisModeCodegenTestsGenerated fail on this test +// IGNORE_BACKEND: JVM interface I { val prop: T diff --git a/compiler/testData/codegen/box/localClasses/closureOfInnerLocalClass.kt b/compiler/testData/codegen/box/localClasses/closureOfInnerLocalClass.kt index c01ad313420..629b491a31d 100644 --- a/compiler/testData/codegen/box/localClasses/closureOfInnerLocalClass.kt +++ b/compiler/testData/codegen/box/localClasses/closureOfInnerLocalClass.kt @@ -1,5 +1,5 @@ // Enable for JVM backend when KT-8120 gets fixed -// TARGET_BACKEND: JS +// IGNORE_BACKEND: JVM fun box(): String { var log = "" diff --git a/compiler/testData/codegen/box/localClasses/closureWithSelfInstantiation.kt b/compiler/testData/codegen/box/localClasses/closureWithSelfInstantiation.kt index 206ccc3d5f7..20727829c28 100644 --- a/compiler/testData/codegen/box/localClasses/closureWithSelfInstantiation.kt +++ b/compiler/testData/codegen/box/localClasses/closureWithSelfInstantiation.kt @@ -1,5 +1,5 @@ // Enable for JVM backend when KT-8120 gets fixed -// TARGET_BACKEND: JS +// IGNORE_BACKEND: JVM fun box(): String { val capturedInConstructor = 1 diff --git a/compiler/testData/codegen/box/properties/augmentedAssignmentsAndIncrements.kt b/compiler/testData/codegen/box/properties/augmentedAssignmentsAndIncrements.kt index 0b8af84ffe1..bde3c09d5c4 100644 --- a/compiler/testData/codegen/box/properties/augmentedAssignmentsAndIncrements.kt +++ b/compiler/testData/codegen/box/properties/augmentedAssignmentsAndIncrements.kt @@ -1,5 +1,5 @@ // Enable when KT-14833 is fixed. -// TARGET_BACKEND: JS +// IGNORE_BACKEND: JVM import kotlin.reflect.KProperty var a = 0 diff --git a/compiler/tests-ir-jvm/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-ir-jvm/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index 4a531d27771..95239a6cd1d 100644 --- a/compiler/tests-ir-jvm/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-ir-jvm/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -6269,6 +6269,18 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/defaultArguments"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true); } + @TestMetadata("implementedByFake.kt") + public void testImplementedByFake() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/defaultArguments/implementedByFake.kt"); + try { + doTest(fileName); + } + catch (Throwable ignore) { + return; + } + throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that."); + } + @TestMetadata("kt6382.kt") public void testKt6382() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/defaultArguments/kt6382.kt"); @@ -10466,12 +10478,36 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes doTest(fileName); } + @TestMetadata("closureOfInnerLocalClass.kt") + public void testClosureOfInnerLocalClass() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/localClasses/closureOfInnerLocalClass.kt"); + try { + doTest(fileName); + } + catch (Throwable ignore) { + return; + } + throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that."); + } + @TestMetadata("closureOfLambdaInLocalClass.kt") public void testClosureOfLambdaInLocalClass() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/localClasses/closureOfLambdaInLocalClass.kt"); doTest(fileName); } + @TestMetadata("closureWithSelfInstantiation.kt") + public void testClosureWithSelfInstantiation() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/localClasses/closureWithSelfInstantiation.kt"); + try { + doTest(fileName); + } + catch (Throwable ignore) { + return; + } + throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that."); + } + @TestMetadata("inExtensionFunction.kt") public void testInExtensionFunction() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/localClasses/inExtensionFunction.kt"); @@ -12533,6 +12569,18 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/properties"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true); } + @TestMetadata("augmentedAssignmentsAndIncrements.kt") + public void testAugmentedAssignmentsAndIncrements() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/properties/augmentedAssignmentsAndIncrements.kt"); + try { + doTest(fileName); + } + catch (Throwable ignore) { + return; + } + throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that."); + } + @TestMetadata("classArtificialFieldInsideNested.kt") public void testClassArtificialFieldInsideNested() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/properties/classArtificialFieldInsideNested.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index 8026c64aeae..1f111811a35 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -6269,6 +6269,18 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/defaultArguments"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true); } + @TestMetadata("implementedByFake.kt") + public void testImplementedByFake() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/defaultArguments/implementedByFake.kt"); + try { + doTest(fileName); + } + catch (Throwable ignore) { + return; + } + throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that."); + } + @TestMetadata("kt6382.kt") public void testKt6382() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/defaultArguments/kt6382.kt"); @@ -10466,12 +10478,36 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { doTest(fileName); } + @TestMetadata("closureOfInnerLocalClass.kt") + public void testClosureOfInnerLocalClass() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/localClasses/closureOfInnerLocalClass.kt"); + try { + doTest(fileName); + } + catch (Throwable ignore) { + return; + } + throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that."); + } + @TestMetadata("closureOfLambdaInLocalClass.kt") public void testClosureOfLambdaInLocalClass() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/localClasses/closureOfLambdaInLocalClass.kt"); doTest(fileName); } + @TestMetadata("closureWithSelfInstantiation.kt") + public void testClosureWithSelfInstantiation() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/localClasses/closureWithSelfInstantiation.kt"); + try { + doTest(fileName); + } + catch (Throwable ignore) { + return; + } + throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that."); + } + @TestMetadata("inExtensionFunction.kt") public void testInExtensionFunction() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/localClasses/inExtensionFunction.kt"); @@ -12533,6 +12569,18 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/properties"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true); } + @TestMetadata("augmentedAssignmentsAndIncrements.kt") + public void testAugmentedAssignmentsAndIncrements() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/properties/augmentedAssignmentsAndIncrements.kt"); + try { + doTest(fileName); + } + catch (Throwable ignore) { + return; + } + throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that."); + } + @TestMetadata("classArtificialFieldInsideNested.kt") public void testClassArtificialFieldInsideNested() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/properties/classArtificialFieldInsideNested.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 25284e116f2..c678b080e02 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -40,6 +40,18 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) public static class Annotations extends AbstractLightAnalysisModeTest { + @TestMetadata("wrongAnnotationArgumentInCtor.kt") + public void ignoreWrongAnnotationArgumentInCtor() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/annotations/wrongAnnotationArgumentInCtor.kt"); + try { + doTest(fileName); + } + catch (Throwable ignore) { + return; + } + throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that."); + } + public void testAllFilesPresentInAnnotations() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/annotations"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true); } @@ -152,18 +164,6 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes doTest(fileName); } - @TestMetadata("wrongAnnotationArgumentInCtor.kt") - public void testWrongAnnotationArgumentInCtor() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/annotations/wrongAnnotationArgumentInCtor.kt"); - try { - doTest(fileName); - } - catch (Throwable ignore) { - return; - } - throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that."); - } - @TestMetadata("compiler/testData/codegen/box/annotations/annotatedLambda") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) @@ -5646,12 +5646,8 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) public static class SuspendFunctionAsCoroutine extends AbstractLightAnalysisModeTest { - public void testAllFilesPresentInSuspendFunctionAsCoroutine() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true); - } - @TestMetadata("augmentedAssignment.kt") - public void testAugmentedAssignment() throws Exception { + public void ignoreAugmentedAssignment() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/augmentedAssignment.kt"); try { doTest(fileName); @@ -5662,6 +5658,10 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that."); } + public void testAllFilesPresentInSuspendFunctionAsCoroutine() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true); + } + @TestMetadata("dispatchResume.kt") public void testDispatchResume() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/dispatchResume.kt"); @@ -6265,6 +6265,18 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) public static class DefaultArguments extends AbstractLightAnalysisModeTest { + @TestMetadata("implementedByFake.kt") + public void ignoreImplementedByFake() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/defaultArguments/implementedByFake.kt"); + try { + doTest(fileName); + } + catch (Throwable ignore) { + return; + } + throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that."); + } + public void testAllFilesPresentInDefaultArguments() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/defaultArguments"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true); } @@ -10450,6 +10462,30 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) public static class LocalClasses extends AbstractLightAnalysisModeTest { + @TestMetadata("closureOfInnerLocalClass.kt") + public void ignoreClosureOfInnerLocalClass() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/localClasses/closureOfInnerLocalClass.kt"); + try { + doTest(fileName); + } + catch (Throwable ignore) { + return; + } + throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that."); + } + + @TestMetadata("closureWithSelfInstantiation.kt") + public void ignoreClosureWithSelfInstantiation() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/localClasses/closureWithSelfInstantiation.kt"); + try { + doTest(fileName); + } + catch (Throwable ignore) { + return; + } + throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that."); + } + public void testAllFilesPresentInLocalClasses() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/localClasses"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true); } @@ -12517,6 +12553,18 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) public static class Properties extends AbstractLightAnalysisModeTest { + @TestMetadata("augmentedAssignmentsAndIncrements.kt") + public void ignoreAugmentedAssignmentsAndIncrements() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/properties/augmentedAssignmentsAndIncrements.kt"); + try { + doTest(fileName); + } + catch (Throwable ignore) { + return; + } + throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that."); + } + @TestMetadata("accessToPrivateProperty.kt") public void testAccessToPrivateProperty() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/properties/accessToPrivateProperty.kt"); diff --git a/generators/src/org/jetbrains/kotlin/generators/tests/GenerateTests.kt b/generators/src/org/jetbrains/kotlin/generators/tests/GenerateTests.kt index 099549f0726..b9262551c68 100755 --- a/generators/src/org/jetbrains/kotlin/generators/tests/GenerateTests.kt +++ b/generators/src/org/jetbrains/kotlin/generators/tests/GenerateTests.kt @@ -255,7 +255,7 @@ fun main(args: Array) { } testClass { - model("codegen/box", targetBackend = TargetBackend.JVM) + model("codegen/box", targetBackend = TargetBackend.JVM, skipIgnored = true) } testClass { @@ -1436,7 +1436,8 @@ class TestGroup(val testsRoot: String, val testDataRoot: String) { testClassName: String? = null, targetBackend: TargetBackend = TargetBackend.ANY, excludeDirs: List = listOf(), - filenameStartsLowerCase: Boolean? = null + filenameStartsLowerCase: Boolean? = null, + skipIgnored: Boolean = false ) { val rootFile = File(testDataRoot + "/" + relativeRootPath) val compiledPattern = Pattern.compile(pattern) @@ -1444,12 +1445,13 @@ class TestGroup(val testsRoot: String, val testDataRoot: String) { testModels.add( if (singleClass) { if (excludeDirs.isNotEmpty()) error("excludeDirs is unsupported for SingleClassTestModel yet") - SingleClassTestModel(rootFile, compiledPattern, filenameStartsLowerCase, testMethod, className, targetBackend) + SingleClassTestModel(rootFile, compiledPattern, filenameStartsLowerCase, testMethod, className, targetBackend, + skipIgnored) } else { SimpleTestClassModel(rootFile, recursive, excludeParentDirs, compiledPattern, filenameStartsLowerCase, testMethod, className, - targetBackend, excludeDirs) + targetBackend, excludeDirs, skipIgnored) } ) } diff --git a/generators/src/org/jetbrains/kotlin/generators/tests/generator/SimpleTestClassModel.java b/generators/src/org/jetbrains/kotlin/generators/tests/generator/SimpleTestClassModel.java index fa1d7ff19e8..7cb9ffbf67d 100644 --- a/generators/src/org/jetbrains/kotlin/generators/tests/generator/SimpleTestClassModel.java +++ b/generators/src/org/jetbrains/kotlin/generators/tests/generator/SimpleTestClassModel.java @@ -53,6 +53,8 @@ public class SimpleTestClassModel implements TestClassModel { @Nullable private Collection testMethods; + private final boolean skipIgnored; + public SimpleTestClassModel( @NotNull File rootFile, boolean recursive, @@ -62,7 +64,8 @@ public class SimpleTestClassModel implements TestClassModel { @NotNull String doTestMethodName, @NotNull String testClassName, @NotNull TargetBackend targetBackend, - @NotNull Collection excludeDirs + @NotNull Collection excludeDirs, + boolean skipIgnored ) { this.rootFile = rootFile; this.recursive = recursive; @@ -73,6 +76,7 @@ public class SimpleTestClassModel implements TestClassModel { this.targetBackend = targetBackend; this.checkFilenameStartsLowerCase = checkFilenameStartsLowerCase; this.excludeDirs = excludeDirs.isEmpty() ? Collections.emptySet() : new LinkedHashSet<>(excludeDirs); + this.skipIgnored = skipIgnored; } @NotNull @@ -91,7 +95,8 @@ public class SimpleTestClassModel implements TestClassModel { String innerTestClassName = TestGeneratorUtil.fileNameToJavaIdentifier(file); children.add(new SimpleTestClassModel( file, true, excludeParentDirs, filenamePattern, checkFilenameStartsLowerCase, - doTestMethodName, innerTestClassName, targetBackend, excludesStripOneDirectory(file.getName())) + doTestMethodName, innerTestClassName, targetBackend, excludesStripOneDirectory(file.getName()), + skipIgnored) ); } } @@ -140,7 +145,7 @@ public class SimpleTestClassModel implements TestClassModel { if (testMethods == null) { if (!rootFile.isDirectory()) { testMethods = Collections.singletonList(new SimpleTestMethodModel( - rootFile, rootFile, doTestMethodName, filenamePattern, checkFilenameStartsLowerCase, targetBackend + rootFile, rootFile, doTestMethodName, filenamePattern, checkFilenameStartsLowerCase, targetBackend, skipIgnored )); } else { @@ -157,7 +162,8 @@ public class SimpleTestClassModel implements TestClassModel { continue; } - result.add(new SimpleTestMethodModel(rootFile, file, doTestMethodName, filenamePattern, checkFilenameStartsLowerCase, targetBackend)); + result.add(new SimpleTestMethodModel(rootFile, file, doTestMethodName, filenamePattern, + checkFilenameStartsLowerCase, targetBackend, skipIgnored)); } } } diff --git a/generators/src/org/jetbrains/kotlin/generators/tests/generator/SimpleTestMethodModel.java b/generators/src/org/jetbrains/kotlin/generators/tests/generator/SimpleTestMethodModel.java index 72e596523c3..8cc5f163363 100644 --- a/generators/src/org/jetbrains/kotlin/generators/tests/generator/SimpleTestMethodModel.java +++ b/generators/src/org/jetbrains/kotlin/generators/tests/generator/SimpleTestMethodModel.java @@ -45,19 +45,23 @@ public class SimpleTestMethodModel implements TestMethodModel { @NotNull private final TargetBackend targetBackend; + private final boolean skipIgnored; + public SimpleTestMethodModel( @NotNull File rootDir, @NotNull File file, @NotNull String doTestMethodName, @NotNull Pattern filenamePattern, @Nullable Boolean checkFilenameStartsLowerCase, - @NotNull TargetBackend targetBackend + @NotNull TargetBackend targetBackend, + boolean skipIgnored ) { this.rootDir = rootDir; this.file = file; this.doTestMethodName = doTestMethodName; this.filenamePattern = filenamePattern; this.targetBackend = targetBackend; + this.skipIgnored = skipIgnored; if (checkFilenameStartsLowerCase != null) { char c = file.getName().charAt(0); @@ -124,7 +128,10 @@ public class SimpleTestMethodModel implements TestMethodModel { String relativePath = FileUtil.getRelativePath(rootDir, file.getParentFile()); unescapedName = relativePath + "-" + StringUtil.capitalize(extractedName); } - return (isIgnoredTargetWithoutCheck(targetBackend, file) ? "ignore" : "test") + StringUtil.capitalize(TestGeneratorUtil.escapeForJavaIdentifier(unescapedName)); + + boolean ignored = isIgnoredTargetWithoutCheck(targetBackend, file) || + skipIgnored && isIgnoredTarget(targetBackend, file); + return (ignored ? "ignore" : "test") + StringUtil.capitalize(TestGeneratorUtil.escapeForJavaIdentifier(unescapedName)); } @Override diff --git a/generators/src/org/jetbrains/kotlin/generators/tests/generator/SingleClassTestModel.java b/generators/src/org/jetbrains/kotlin/generators/tests/generator/SingleClassTestModel.java index 4faae61a4e8..cd06e5896f7 100644 --- a/generators/src/org/jetbrains/kotlin/generators/tests/generator/SingleClassTestModel.java +++ b/generators/src/org/jetbrains/kotlin/generators/tests/generator/SingleClassTestModel.java @@ -48,13 +48,16 @@ public class SingleClassTestModel implements TestClassModel { @Nullable private Collection methods; + private final boolean skipIgnored; + public SingleClassTestModel( @NotNull File rootFile, @NotNull Pattern filenamePattern, @Nullable Boolean checkFilenameStartsLowerCase, @NotNull String doTestMethodName, @NotNull String testClassName, - @NotNull TargetBackend targetBackend + @NotNull TargetBackend targetBackend, + boolean skipIgnored ) { this.rootFile = rootFile; this.filenamePattern = filenamePattern; @@ -62,6 +65,7 @@ public class SingleClassTestModel implements TestClassModel { this.doTestMethodName = doTestMethodName; this.testClassName = testClassName; this.targetBackend = targetBackend; + this.skipIgnored = skipIgnored; } @NotNull @@ -97,7 +101,7 @@ public class SingleClassTestModel implements TestClassModel { @NotNull private Collection getTestMethodsFromFile(File file) { return Collections.singletonList(new SimpleTestMethodModel( - rootFile, file, doTestMethodName, filenamePattern, checkFilenameStartsLowerCase, targetBackend + rootFile, file, doTestMethodName, filenamePattern, checkFilenameStartsLowerCase, targetBackend, skipIgnored )); }