Mute tests to avoid primitive type annotation

Relates to #KT-45417

GitOrigin-RevId: d5739e158db8d2138b77ec613d9e48e15f89c310
This commit is contained in:
Vladimir Dolzhenko
2021-03-14 00:33:16 +03:00
committed by intellij-monorepo-bot
parent 36c0b4b3ea
commit ceabcf9303
8 changed files with 19 additions and 11 deletions
@@ -7,8 +7,6 @@ package org.jetbrains.kotlin.asJava.classes
import com.intellij.testFramework.LightProjectDescriptor
import org.jetbrains.kotlin.asJava.LightClassGenerationSupport
import org.jetbrains.kotlin.asJava.PsiClassRenderer
import org.jetbrains.kotlin.asJava.PsiClassRenderer.renderClass
import org.jetbrains.kotlin.idea.perf.UltraLightChecker
import org.jetbrains.kotlin.idea.perf.UltraLightChecker.checkByJavaFile
import org.jetbrains.kotlin.idea.perf.UltraLightChecker.checkDescriptorsLeak
@@ -17,7 +15,6 @@ import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescrip
import org.jetbrains.kotlin.idea.test.withCustomCompilerOptions
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.test.InTextDirectivesUtils
import org.jetbrains.kotlin.test.KotlinTestUtils
import java.io.File
abstract class AbstractUltraLightClassLoadingTest : KotlinLightCodeInsightFixtureTestCase() {
@@ -25,6 +22,8 @@ abstract class AbstractUltraLightClassLoadingTest : KotlinLightCodeInsightFixtur
open fun doTest(testDataPath: String) {
val sourceText = File(testDataPath).readText()
InTextDirectivesUtils.checkIfMuted(sourceText);
withCustomCompilerOptions(sourceText, project, module) {
val file = myFixture.addFileToProject(testDataPath, sourceText) as KtFile
@@ -63,6 +63,7 @@ abstract class AbstractQuickFixTest : KotlinLightCodeInsightFixtureTestCase(), Q
@Throws(Exception::class)
protected fun doTest(beforeFileName: String) {
val beforeFileText = FileUtil.loadFile(File(beforeFileName))
InTextDirectivesUtils.checkIfMuted(beforeFileText);
withCustomCompilerOptions(beforeFileText, project, module) {
val inspections = parseInspectionsToEnable(beforeFileName, beforeFileText).toTypedArray()
try {
@@ -1,3 +1,4 @@
// MUTED: "Muted till 1.4.32"
class Inv<E>
class Out<out T>
class OutPair<out Final, out Y>
@@ -1,8 +1,8 @@
// MUTED: "Muted till 1.4.32"
// "Add annotation target" "true"
annotation class Foo
class Test {
// TODO: [VD] temporary broken due to https://youtrack.jetbrains.com/issue/KT-45417
fun foo(): @Foo Int = 1
fun foo(): <caret>@Foo Int = 1
}
@@ -1,10 +1,10 @@
// MUTED: "Muted till 1.4.32"
// "Add annotation target" "true"
annotation class Foo
@Foo
class Test {
// TODO: [VD] temporary broken due to https://youtrack.jetbrains.com/issue/KT-45417
@Foo
fun foo(): @Foo Int = 1
fun foo(): <caret>@Foo Int = 1
}
@@ -1,9 +1,9 @@
// MUTED: "Muted till 1.4.32"
// "Add annotation target" "true"
@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION)
annotation class Foo
class Test {
// TODO: [VD] temporary broken due to https://youtrack.jetbrains.com/issue/KT-45417
fun foo(): @Foo Int = 1
fun foo(): <caret>@Foo Int = 1
}
@@ -1,3 +1,4 @@
// MUTED: "Muted till 1.4.32"
// "Add annotation target" "true"
@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION)
@@ -6,6 +7,5 @@ annotation class Foo
@Foo
class Test {
@Foo
// TODO: [VD] temporary broken due to https://youtrack.jetbrains.com/issue/KT-45417
fun foo(): @Foo Int = 1
fun foo(): <caret>@Foo Int = 1
}
@@ -26,6 +26,7 @@ public final class InTextDirectivesUtils {
private static final String DIRECTIVES_FILE_NAME = "directives.txt";
public static final String IGNORE_BACKEND_DIRECTIVE_PREFIX = "// IGNORE_BACKEND: ";
public static final String MUTED_DIRECTIVE_PREFIX = "// MUTED: ";
private InTextDirectivesUtils() {
}
@@ -247,4 +248,10 @@ public final class InTextDirectivesUtils {
public static boolean isIgnoredTarget(TargetBackend targetBackend, File file) {
return isIgnoredTarget(targetBackend, file, IGNORE_BACKEND_DIRECTIVE_PREFIX);
}
public static void checkIfMuted(String fileText) {
List<String> muted = findListWithPrefixes(fileText, MUTED_DIRECTIVE_PREFIX);
if (muted.isEmpty()) return;
throw new RuntimeException("muted:" + muted);
}
}