[SAM with receiver] Partially migrate tests to new infrastructure

Script tests still use old infrastructure, because there is no support
  for them in new framework
This commit is contained in:
Dmitriy Novozhilov
2022-06-22 13:57:21 +03:00
committed by teamcity
parent 04bf5bfe0b
commit 49c836e706
13 changed files with 66 additions and 37 deletions
@@ -0,0 +1,36 @@
/*
* 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.samWithReceiver;
import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
import org.jetbrains.kotlin.test.KotlinTestUtils;
import org.jetbrains.kotlin.test.util.KtTestUtil;
import org.jetbrains.kotlin.test.TestMetadata;
import org.junit.runner.RunWith;
import java.io.File;
import java.util.regex.Pattern;
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@TestMetadata("plugins/sam-with-receiver/testData/script")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public class SamWithReceiverScriptNewDefTestGenerated extends AbstractSamWithReceiverScriptNewDefTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInScript() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("plugins/sam-with-receiver/testData/script"), Pattern.compile("^(.+)\\.kts$"), null, true);
}
@TestMetadata("samConversionSimple.kts")
public void testSamConversionSimple() throws Exception {
runTest("plugins/sam-with-receiver/testData/script/samConversionSimple.kts");
}
}
@@ -6,69 +6,73 @@
package org.jetbrains.kotlin.samWithReceiver;
import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
import org.jetbrains.kotlin.test.KotlinTestUtils;
import org.jetbrains.kotlin.test.util.KtTestUtil;
import org.jetbrains.kotlin.test.TestMetadata;
import org.junit.runner.RunWith;
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.TestsPackage}. DO NOT MODIFY MANUALLY */
/** This class is generated by {@link GenerateNewCompilerTests.kt}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@TestMetadata("plugins/sam-with-receiver/testData/diagnostics")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public class SamWithReceiverTestGenerated extends AbstractSamWithReceiverTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
@Test
public void testAllFilesPresentInDiagnostics() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("plugins/sam-with-receiver/testData/diagnostics"), Pattern.compile("^(.+)\\.kt$"), null, true);
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("plugins/sam-with-receiver/testData/diagnostics"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
}
@Test
@TestMetadata("noParameters.kt")
public void testNoParameters() throws Exception {
runTest("plugins/sam-with-receiver/testData/diagnostics/noParameters.kt");
}
@Test
@TestMetadata("noReturnType.kt")
public void testNoReturnType() throws Exception {
runTest("plugins/sam-with-receiver/testData/diagnostics/noReturnType.kt");
}
@Test
@TestMetadata("samConversionNoParameters.kt")
public void testSamConversionNoParameters() throws Exception {
runTest("plugins/sam-with-receiver/testData/diagnostics/samConversionNoParameters.kt");
}
@Test
@TestMetadata("samConversionSimple.kt")
public void testSamConversionSimple() throws Exception {
runTest("plugins/sam-with-receiver/testData/diagnostics/samConversionSimple.kt");
}
@Test
@TestMetadata("samConversionSimpleWithoutAnnotation.kt")
public void testSamConversionSimpleWithoutAnnotation() throws Exception {
runTest("plugins/sam-with-receiver/testData/diagnostics/samConversionSimpleWithoutAnnotation.kt");
}
@Test
@TestMetadata("samWithAnnotation.kt")
public void testSamWithAnnotation() throws Exception {
runTest("plugins/sam-with-receiver/testData/diagnostics/samWithAnnotation.kt");
}
@Test
@TestMetadata("samWithoutAnnotation.kt")
public void testSamWithoutAnnotation() throws Exception {
runTest("plugins/sam-with-receiver/testData/diagnostics/samWithoutAnnotation.kt");
}
@Test
@TestMetadata("singleParameter.kt")
public void testSingleParameter() throws Exception {
runTest("plugins/sam-with-receiver/testData/diagnostics/singleParameter.kt");
}
@Test
@TestMetadata("singleParameterWithoutAnnotation.kt")
public void testSingleParameterWithoutAnnotation() throws Exception {
runTest("plugins/sam-with-receiver/testData/diagnostics/singleParameterWithoutAnnotation.kt");