[LL FIR] add LL FIR tests based on AbstractFirPsiNativeDiagnosticsTest
^KT-62910 fixed
This commit is contained in:
committed by
Space Team
parent
a4564351d7
commit
bffbbe6293
@@ -0,0 +1,38 @@
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
id("jps-compatible")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
testImplementation(project(":analysis:low-level-api-fir"))
|
||||
testImplementation(project(":analysis:analysis-api-standalone:analysis-api-fir-standalone-base"))
|
||||
testImplementation(projectTests(":compiler:tests-common"))
|
||||
testImplementation(projectTests(":analysis:analysis-api-impl-barebone"))
|
||||
testImplementation(projectTests(":analysis:analysis-test-framework"))
|
||||
testImplementation(projectTests(":analysis:analysis-api-impl-base"))
|
||||
testImplementation(projectTests(":analysis:low-level-api-fir"))
|
||||
testImplementation(projectTests(":native:native.tests"))
|
||||
|
||||
testImplementation(platform(libs.junit.bom))
|
||||
testImplementation(libs.junit.jupiter.api)
|
||||
testRuntimeOnly(libs.junit.jupiter.engine)
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
"main" { none() }
|
||||
"test" {
|
||||
projectDefault()
|
||||
generatedTestDir()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
projectTest(jUnitMode = JUnitMode.JUnit5) {
|
||||
dependsOn(":dist")
|
||||
workingDir = rootDir
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
nativeTest("llFirNativeTests", "llFirNative")
|
||||
|
||||
testsJar()
|
||||
+112
@@ -0,0 +1,112 @@
|
||||
/*
|
||||
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.analysis.low.level.api.fir.konan.compiler.based;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil;
|
||||
import org.junit.jupiter.api.Tag;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.jupiter.api.Nested;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.analysis.api.konan.GenerateAnalysisApiNativeTestsKt}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("compiler/testData/diagnostics/nativeTests")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Tag("llFirNative")
|
||||
public class LLFirNativeTestGenerated extends AbstractLLFirNativeTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInNativeTests() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/nativeTests"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("arrays_after.kt")
|
||||
public void testArrays_after() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/nativeTests/arrays_after.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("cloneableInNative.kt")
|
||||
public void testCloneableInNative() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/nativeTests/cloneableInNative.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("forwardDeclarations.kt")
|
||||
public void testForwardDeclarations() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/nativeTests/forwardDeclarations.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("identifiers.kt")
|
||||
public void testIdentifiers() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/nativeTests/identifiers.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("isInitialized.kt")
|
||||
public void testIsInitialized() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/nativeTests/isInitialized.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("isInitializedError.kt")
|
||||
public void testIsInitializedError() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/nativeTests/isInitializedError.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nativeProtectedFunCall.kt")
|
||||
public void testNativeProtectedFunCall() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/nativeTests/nativeProtectedFunCall.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("objCName.kt")
|
||||
public void testObjCName() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/nativeTests/objCName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("objCRefinement.kt")
|
||||
public void testObjCRefinement() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/nativeTests/objCRefinement.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("sharedImmutable.kt")
|
||||
public void testSharedImmutable() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/nativeTests/sharedImmutable.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("threadLocal.kt")
|
||||
public void testThreadLocal() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/nativeTests/threadLocal.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("throws.kt")
|
||||
public void testThrows() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/nativeTests/throws.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("throwsClash.kt")
|
||||
public void testThrowsClash() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/nativeTests/throwsClash.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("topLevelSingleton.kt")
|
||||
public void testTopLevelSingleton() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/nativeTests/topLevelSingleton.kt");
|
||||
}
|
||||
}
|
||||
+112
@@ -0,0 +1,112 @@
|
||||
/*
|
||||
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.analysis.low.level.api.fir.konan.compiler.based;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil;
|
||||
import org.junit.jupiter.api.Tag;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.jupiter.api.Nested;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.analysis.api.konan.GenerateAnalysisApiNativeTestsKt}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("compiler/testData/diagnostics/nativeTests")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Tag("llFirNative")
|
||||
public class LLFirReversedNativeTestGenerated extends AbstractLLFirReversedNativeTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInNativeTests() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/nativeTests"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("arrays_after.kt")
|
||||
public void testArrays_after() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/nativeTests/arrays_after.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("cloneableInNative.kt")
|
||||
public void testCloneableInNative() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/nativeTests/cloneableInNative.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("forwardDeclarations.kt")
|
||||
public void testForwardDeclarations() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/nativeTests/forwardDeclarations.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("identifiers.kt")
|
||||
public void testIdentifiers() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/nativeTests/identifiers.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("isInitialized.kt")
|
||||
public void testIsInitialized() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/nativeTests/isInitialized.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("isInitializedError.kt")
|
||||
public void testIsInitializedError() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/nativeTests/isInitializedError.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nativeProtectedFunCall.kt")
|
||||
public void testNativeProtectedFunCall() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/nativeTests/nativeProtectedFunCall.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("objCName.kt")
|
||||
public void testObjCName() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/nativeTests/objCName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("objCRefinement.kt")
|
||||
public void testObjCRefinement() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/nativeTests/objCRefinement.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("sharedImmutable.kt")
|
||||
public void testSharedImmutable() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/nativeTests/sharedImmutable.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("threadLocal.kt")
|
||||
public void testThreadLocal() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/nativeTests/threadLocal.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("throws.kt")
|
||||
public void testThrows() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/nativeTests/throws.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("throwsClash.kt")
|
||||
public void testThrowsClash() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/nativeTests/throwsClash.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("topLevelSingleton.kt")
|
||||
public void testTopLevelSingleton() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/nativeTests/topLevelSingleton.kt");
|
||||
}
|
||||
}
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.analysis.low.level.api.fir.konan.compiler.based
|
||||
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.LLFirOnlyNonReversedTestSuppressor
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.LLFirOnlyReversedTestSuppressor
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.compiler.based.AbstractCompilerBasedTestForFir
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.diagnostic.compiler.based.ReversedFirIdenticalChecker
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.diagnostic.compiler.based.facades.LLFirAnalyzerFacadeFactoryWithPreresolveInReversedOrder
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.diagnostic.compiler.based.facades.LLFirAnalyzerFacadeFactoryWithoutPreresolve
|
||||
import org.jetbrains.kotlin.konan.test.diagnostics.baseFirNativeDiagnosticTestConfiguration
|
||||
import org.jetbrains.kotlin.konan.test.diagnostics.baseNativeDiagnosticTestConfiguration
|
||||
import org.jetbrains.kotlin.platform.konan.NativePlatforms
|
||||
import org.jetbrains.kotlin.test.bind
|
||||
import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
|
||||
import org.jetbrains.kotlin.test.runners.configurationForClassicAndFirTestsAlongside
|
||||
|
||||
abstract class AbstractLLFirNativeTestBase : AbstractCompilerBasedTestForFir() {
|
||||
|
||||
protected fun TestConfigurationBuilder.baseConfiguration() {
|
||||
globalDefaults {
|
||||
targetPlatform = NativePlatforms.unspecifiedNativePlatform
|
||||
}
|
||||
baseFirNativeDiagnosticTestConfiguration()
|
||||
configurationForClassicAndFirTestsAlongside(::ReversedFirIdenticalChecker)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
abstract class AbstractLLFirNativeTest : AbstractLLFirNativeTestBase() {
|
||||
override fun TestConfigurationBuilder.configureTest() {
|
||||
baseNativeDiagnosticTestConfiguration(::LowLevelFirFrontendFacade.bind(LLFirAnalyzerFacadeFactoryWithoutPreresolve))
|
||||
baseConfiguration()
|
||||
useAfterAnalysisCheckers(::LLFirOnlyNonReversedTestSuppressor)
|
||||
}
|
||||
}
|
||||
|
||||
abstract class AbstractLLFirReversedNativeTest : AbstractLLFirNativeTestBase() {
|
||||
override fun TestConfigurationBuilder.configureTest() {
|
||||
baseNativeDiagnosticTestConfiguration(::LowLevelFirFrontendFacade.bind(LLFirAnalyzerFacadeFactoryWithPreresolveInReversedOrder))
|
||||
baseConfiguration()
|
||||
useAfterAnalysisCheckers(::LLFirOnlyReversedTestSuppressor)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user