[LL FIR] add script tests for AbstractFirContextCollectionTest

^KT-60728
This commit is contained in:
Dmitrii Gridin
2023-07-26 20:26:17 +02:00
committed by Space Team
parent 3ed5ccbb6f
commit 9970663a2b
5 changed files with 173 additions and 5 deletions
@@ -21,6 +21,7 @@ import org.jetbrains.kotlin.analysis.low.level.api.fir.sessions.LLFirSession
import org.jetbrains.kotlin.analysis.low.level.api.fir.sessions.LLFirSessionConfigurator
import org.jetbrains.kotlin.analysis.low.level.api.fir.test.base.AbstractLowLevelApiSingleFileTest
import org.jetbrains.kotlin.analysis.low.level.api.fir.test.configurators.AnalysisApiFirOutOfContentRootTestConfigurator
import org.jetbrains.kotlin.analysis.low.level.api.fir.test.configurators.AnalysisApiFirScriptTestConfigurator
import org.jetbrains.kotlin.analysis.low.level.api.fir.test.configurators.AnalysisApiFirSourceTestConfigurator
import org.jetbrains.kotlin.analysis.low.level.api.fir.useFirSessionConfigurator
import org.jetbrains.kotlin.fir.SessionConfiguration
@@ -115,5 +116,9 @@ abstract class AbstractFirSourceContextCollectionTest : AbstractFirContextCollec
}
abstract class AbstractFirOutOfContentRootContextCollectionTest : AbstractFirContextCollectionTest() {
override val configurator = AnalysisApiFirOutOfContentRootTestConfigurator
override val configurator get() = AnalysisApiFirOutOfContentRootTestConfigurator
}
abstract class AbstractScriptContextCollectionTest : AbstractFirContextCollectionTest() {
override val configurator get() = AnalysisApiFirScriptTestConfigurator
}
@@ -21,7 +21,7 @@ import java.util.regex.Pattern;
public class FirOutOfContentRootContextCollectionTestGenerated extends AbstractFirOutOfContentRootContextCollectionTest {
@Test
public void testAllFilesPresentInFileStructure() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/low-level-api-fir/testdata/fileStructure"), Pattern.compile("^(.+)\\.kt$"), null, true);
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/low-level-api-fir/testdata/fileStructure"), Pattern.compile("^(.+)\\.(kt)$"), null, true);
}
@Test
@@ -21,7 +21,7 @@ import java.util.regex.Pattern;
public class FirSourceContextCollectionTestGenerated extends AbstractFirSourceContextCollectionTest {
@Test
public void testAllFilesPresentInFileStructure() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/low-level-api-fir/testdata/fileStructure"), Pattern.compile("^(.+)\\.kt$"), null, true);
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/low-level-api-fir/testdata/fileStructure"), Pattern.compile("^(.+)\\.(kt)$"), null, true);
}
@Test
@@ -0,0 +1,158 @@
/*
* 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.diagnostic;
import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.test.util.KtTestUtil;
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.GenerateAnalysisApiTestsKt}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@TestMetadata("analysis/low-level-api-fir/testdata/fileStructure")
@TestDataPath("$PROJECT_ROOT")
public class ScriptContextCollectionTestGenerated extends AbstractScriptContextCollectionTest {
@Test
public void testAllFilesPresentInFileStructure() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/low-level-api-fir/testdata/fileStructure"), Pattern.compile("^(.+)\\.(kts)$"), null, true);
}
@Test
@TestMetadata("classMemberPropertyScript.kts")
public void testClassMemberPropertyScript() throws Exception {
runTest("analysis/low-level-api-fir/testdata/fileStructure/classMemberPropertyScript.kts");
}
@Test
@TestMetadata("classScript.kts")
public void testClassScript() throws Exception {
runTest("analysis/low-level-api-fir/testdata/fileStructure/classScript.kts");
}
@Test
@TestMetadata("constructorsScript.kts")
public void testConstructorsScript() throws Exception {
runTest("analysis/low-level-api-fir/testdata/fileStructure/constructorsScript.kts");
}
@Test
@TestMetadata("danglingAnnotationClassLevelScript.kts")
public void testDanglingAnnotationClassLevelScript() throws Exception {
runTest("analysis/low-level-api-fir/testdata/fileStructure/danglingAnnotationClassLevelScript.kts");
}
@Test
@TestMetadata("declarationsInPropertyInitScript.kts")
public void testDeclarationsInPropertyInitScript() throws Exception {
runTest("analysis/low-level-api-fir/testdata/fileStructure/declarationsInPropertyInitScript.kts");
}
@Test
@TestMetadata("enumClassScript.kts")
public void testEnumClassScript() throws Exception {
runTest("analysis/low-level-api-fir/testdata/fileStructure/enumClassScript.kts");
}
@Test
@TestMetadata("enumClassWithBodyScript.kts")
public void testEnumClassWithBodyScript() throws Exception {
runTest("analysis/low-level-api-fir/testdata/fileStructure/enumClassWithBodyScript.kts");
}
@Test
@TestMetadata("initBlockScript.kts")
public void testInitBlockScript() throws Exception {
runTest("analysis/low-level-api-fir/testdata/fileStructure/initBlockScript.kts");
}
@Test
@TestMetadata("localClassScript.kts")
public void testLocalClassScript() throws Exception {
runTest("analysis/low-level-api-fir/testdata/fileStructure/localClassScript.kts");
}
@Test
@TestMetadata("localFunScript.kts")
public void testLocalFunScript() throws Exception {
runTest("analysis/low-level-api-fir/testdata/fileStructure/localFunScript.kts");
}
@Test
@TestMetadata("localPropertyScript.kts")
public void testLocalPropertyScript() throws Exception {
runTest("analysis/low-level-api-fir/testdata/fileStructure/localPropertyScript.kts");
}
@Test
@TestMetadata("memberTypeAliasScript.kts")
public void testMemberTypeAliasScript() throws Exception {
runTest("analysis/low-level-api-fir/testdata/fileStructure/memberTypeAliasScript.kts");
}
@Test
@TestMetadata("nestedClassesScript.kts")
public void testNestedClassesScript() throws Exception {
runTest("analysis/low-level-api-fir/testdata/fileStructure/nestedClassesScript.kts");
}
@Test
@TestMetadata("propertyAccessorsScript.kts")
public void testPropertyAccessorsScript() throws Exception {
runTest("analysis/low-level-api-fir/testdata/fileStructure/propertyAccessorsScript.kts");
}
@Test
@TestMetadata("script.kts")
public void testScript() throws Exception {
runTest("analysis/low-level-api-fir/testdata/fileStructure/script.kts");
}
@Test
@TestMetadata("superClassCallScript.kts")
public void testSuperClassCallScript() throws Exception {
runTest("analysis/low-level-api-fir/testdata/fileStructure/superClassCallScript.kts");
}
@Test
@TestMetadata("topLevelExpressionBodyFunWithTypeScript.kts")
public void testTopLevelExpressionBodyFunWithTypeScript() throws Exception {
runTest("analysis/low-level-api-fir/testdata/fileStructure/topLevelExpressionBodyFunWithTypeScript.kts");
}
@Test
@TestMetadata("topLevelExpressionBodyFunWithoutTypeScript.kts")
public void testTopLevelExpressionBodyFunWithoutTypeScript() throws Exception {
runTest("analysis/low-level-api-fir/testdata/fileStructure/topLevelExpressionBodyFunWithoutTypeScript.kts");
}
@Test
@TestMetadata("topLevelFunWithTypeScript.kts")
public void testTopLevelFunWithTypeScript() throws Exception {
runTest("analysis/low-level-api-fir/testdata/fileStructure/topLevelFunWithTypeScript.kts");
}
@Test
@TestMetadata("topLevelPropertyScript.kts")
public void testTopLevelPropertyScript() throws Exception {
runTest("analysis/low-level-api-fir/testdata/fileStructure/topLevelPropertyScript.kts");
}
@Test
@TestMetadata("topLevelUnitFunScript.kts")
public void testTopLevelUnitFunScript() throws Exception {
runTest("analysis/low-level-api-fir/testdata/fileStructure/topLevelUnitFunScript.kts");
}
@Test
@TestMetadata("withoutNameScript.kts")
public void testWithoutNameScript() throws Exception {
runTest("analysis/low-level-api-fir/testdata/fileStructure/withoutNameScript.kts");
}
}
@@ -10,6 +10,7 @@ import org.jetbrains.kotlin.analysis.low.level.api.fir.diagnostic.compiler.based
import org.jetbrains.kotlin.analysis.low.level.api.fir.diagnostic.AbstractDiagnosticTraversalCounterTest
import org.jetbrains.kotlin.analysis.low.level.api.fir.diagnostic.AbstractFirOutOfContentRootContextCollectionTest
import org.jetbrains.kotlin.analysis.low.level.api.fir.diagnostic.AbstractFirSourceContextCollectionTest
import org.jetbrains.kotlin.analysis.low.level.api.fir.diagnostic.AbstractScriptContextCollectionTest
import org.jetbrains.kotlin.analysis.low.level.api.fir.diagnostic.compiler.based.AbstractDiagnosticCompilerTestDataTest
import org.jetbrains.kotlin.analysis.low.level.api.fir.diagnostic.compiler.based.AbstractLLFirPreresolvedReversedDiagnosticCompilerTestDataSpecTest
import org.jetbrains.kotlin.analysis.low.level.api.fir.diagnostic.compiler.based.AbstractLLFirPreresolvedReversedDiagnosticCompilerTestDataTest
@@ -81,11 +82,15 @@ internal fun TestGroupSuite.generateFirLowLevelApiTests() {
}
testClass<AbstractFirSourceContextCollectionTest> {
model("fileStructure")
model("fileStructure", pattern = TestGeneratorUtil.KT)
}
testClass<AbstractFirOutOfContentRootContextCollectionTest> {
model("fileStructure")
model("fileStructure", pattern = TestGeneratorUtil.KT)
}
testClass<AbstractScriptContextCollectionTest> {
model("fileStructure", pattern = TestGeneratorUtil.KTS)
}
testClass<AbstractDiagnosticTraversalCounterTest> {