Analysis API: add test covering get missing when branches

Also fix FIR implementation to generate boolean branches in the same
order as FE1.0.
This commit is contained in:
Tianyu Geng
2021-11-02 17:37:33 -07:00
committed by Ilya Kirillov
parent 8ba2e4d221
commit 2c2851af6e
37 changed files with 455 additions and 17 deletions
@@ -0,0 +1,11 @@
/*
* Copyright 2010-2021 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.api.descriptors.test.components
import org.jetbrains.kotlin.analysis.api.descriptors.test.KtFe10FrontendApiTestConfiguratorService
import org.jetbrains.kotlin.analysis.api.impl.base.test.components.AbstractWhenMissingCasesTest
abstract class AbstractKtFe10WhenMissingCasesTest : AbstractWhenMissingCasesTest(KtFe10FrontendApiTestConfiguratorService)
@@ -0,0 +1,110 @@
/*
* Copyright 2010-2021 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.api.descriptors.test.components;
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 GenerateNewCompilerTests.kt}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@TestMetadata("analysis/analysis-api/testData/components/whenMissingCases")
@TestDataPath("$PROJECT_ROOT")
public class KtFe10WhenMissingCasesTestGenerated extends AbstractKtFe10WhenMissingCasesTest {
@Test
public void testAllFilesPresentInWhenMissingCases() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/whenMissingCases"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("boolean_else.kt")
public void testBoolean_else() throws Exception {
runTest("analysis/analysis-api/testData/components/whenMissingCases/boolean_else.kt");
}
@Test
@TestMetadata("boolean_empty.kt")
public void testBoolean_empty() throws Exception {
runTest("analysis/analysis-api/testData/components/whenMissingCases/boolean_empty.kt");
}
@Test
@TestMetadata("boolean_partial.kt")
public void testBoolean_partial() throws Exception {
runTest("analysis/analysis-api/testData/components/whenMissingCases/boolean_partial.kt");
}
@Test
@TestMetadata("enum_else.kt")
public void testEnum_else() throws Exception {
runTest("analysis/analysis-api/testData/components/whenMissingCases/enum_else.kt");
}
@Test
@TestMetadata("enum_empty.kt")
public void testEnum_empty() throws Exception {
runTest("analysis/analysis-api/testData/components/whenMissingCases/enum_empty.kt");
}
@Test
@TestMetadata("enum_partial.kt")
public void testEnum_partial() throws Exception {
runTest("analysis/analysis-api/testData/components/whenMissingCases/enum_partial.kt");
}
@Test
@TestMetadata("nothing.kt")
public void testNothing() throws Exception {
runTest("analysis/analysis-api/testData/components/whenMissingCases/nothing.kt");
}
@Test
@TestMetadata("nullableBoolean.kt")
public void testNullableBoolean() throws Exception {
runTest("analysis/analysis-api/testData/components/whenMissingCases/nullableBoolean.kt");
}
@Test
@TestMetadata("nullableEnum.kt")
public void testNullableEnum() throws Exception {
runTest("analysis/analysis-api/testData/components/whenMissingCases/nullableEnum.kt");
}
@Test
@TestMetadata("nullableNothing.kt")
public void testNullableNothing() throws Exception {
runTest("analysis/analysis-api/testData/components/whenMissingCases/nullableNothing.kt");
}
@Test
@TestMetadata("nullableSealedClass_empty.kt")
public void testNullableSealedClass_empty() throws Exception {
runTest("analysis/analysis-api/testData/components/whenMissingCases/nullableSealedClass_empty.kt");
}
@Test
@TestMetadata("sealedClass_else.kt")
public void testSealedClass_else() throws Exception {
runTest("analysis/analysis-api/testData/components/whenMissingCases/sealedClass_else.kt");
}
@Test
@TestMetadata("sealedClass_empty.kt")
public void testSealedClass_empty() throws Exception {
runTest("analysis/analysis-api/testData/components/whenMissingCases/sealedClass_empty.kt");
}
@Test
@TestMetadata("sealedClass_partial.kt")
public void testSealedClass_partial() throws Exception {
runTest("analysis/analysis-api/testData/components/whenMissingCases/sealedClass_partial.kt");
}
}