[TEST] Migrate AbstractDiagnosticsWithModifiedMockJdkTest to new test runners
This commit is contained in:
+13
@@ -0,0 +1,13 @@
|
||||
// !JDK_KIND: MODIFIED_MOCK_JDK
|
||||
// !CHECK_TYPE
|
||||
// SKIP_TXT
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(s: String) {
|
||||
s.isBlank()
|
||||
s.lines().checkType { _<List<String>>() }
|
||||
s.repeat(1)
|
||||
|
||||
// We don't have `strip` extension, so leave it for a while in gray list
|
||||
s.<!UNRESOLVED_REFERENCE!>strip<!>()
|
||||
}
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// !JDK_KIND: MODIFIED_MOCK_JDK
|
||||
// !CHECK_TYPE
|
||||
// SKIP_TXT
|
||||
// WITH_RUNTIME
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// !JDK_KIND: MODIFIED_MOCK_JDK
|
||||
// !CHECK_TYPE
|
||||
|
||||
interface A : MutableCollection<String> {
|
||||
// Override of deprecated function could be marked as deprecated too
|
||||
override fun nonExistingMethod(x: String) = ""
|
||||
}
|
||||
|
||||
fun foo(x: MutableCollection<Int>, y: Collection<String>, z: A) {
|
||||
x.<!UNRESOLVED_REFERENCE!>nonExistingMethod<!>(1).<!INAPPLICABLE_CANDIDATE!>checkType<!> { <!INAPPLICABLE_CANDIDATE!>_<!><String>() }
|
||||
y.<!UNRESOLVED_REFERENCE!>nonExistingMethod<!>("")
|
||||
z.nonExistingMethod("")
|
||||
}
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// !JDK_KIND: MODIFIED_MOCK_JDK
|
||||
// !CHECK_TYPE
|
||||
|
||||
interface A : MutableCollection<String> {
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// !JDK_KIND: MODIFIED_MOCK_JDK
|
||||
abstract class A : Throwable(1.0) {}
|
||||
|
||||
fun foo() {
|
||||
Throwable(1.5)
|
||||
}
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// !JDK_KIND: MODIFIED_MOCK_JDK
|
||||
abstract class A : <!DEPRECATION!>Throwable<!>(1.0) {}
|
||||
|
||||
fun foo() {
|
||||
Generated
+28
@@ -28200,6 +28200,34 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/testWithModifiedMockJdk")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class TestWithModifiedMockJdk extends AbstractDiagnosticTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInTestWithModifiedMockJdk() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/testWithModifiedMockJdk"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("newStringMethods.kt")
|
||||
public void testNewStringMethods() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/testWithModifiedMockJdk/newStringMethods.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("notConsideredMethod.kt")
|
||||
public void testNotConsideredMethod() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/testWithModifiedMockJdk/notConsideredMethod.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("throwableConstructor.kt")
|
||||
public void testThrowableConstructor() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/testWithModifiedMockJdk/throwableConstructor.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/testsWithExplicitApi")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+28
@@ -28104,6 +28104,34 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/testWithModifiedMockJdk")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class TestWithModifiedMockJdk extends AbstractFirDiagnosticTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInTestWithModifiedMockJdk() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/testWithModifiedMockJdk"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("newStringMethods.kt")
|
||||
public void testNewStringMethods() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/testWithModifiedMockJdk/newStringMethods.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("notConsideredMethod.kt")
|
||||
public void testNotConsideredMethod() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/testWithModifiedMockJdk/notConsideredMethod.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("throwableConstructor.kt")
|
||||
public void testThrowableConstructor() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/testWithModifiedMockJdk/throwableConstructor.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/testsWithExplicitApi")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
-25
@@ -1,25 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jetbrains.kotlin.cfg
|
||||
|
||||
import org.jetbrains.kotlin.checkers.AbstractDiagnosticsTest
|
||||
import org.jetbrains.kotlin.test.TestJdkKind
|
||||
|
||||
abstract class AbstractDiagnosticsWithModifiedMockJdkTest : AbstractDiagnosticsTest() {
|
||||
override fun getTestJdkKind(files: List<TestFile>): TestJdkKind {
|
||||
return TestJdkKind.MODIFIED_MOCK_JDK
|
||||
}
|
||||
}
|
||||
Generated
-45
@@ -1,45 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2020 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.cfg;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
||||
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("compiler/testData/diagnostics/testWithModifiedMockJdk")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public class DiagnosticsWithModifiedMockJdkTestGenerated extends AbstractDiagnosticsWithModifiedMockJdkTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInTestWithModifiedMockJdk() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testWithModifiedMockJdk"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@TestMetadata("newStringMethods.kt")
|
||||
public void testNewStringMethods() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testWithModifiedMockJdk/newStringMethods.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("notConsideredMethod.kt")
|
||||
public void testNotConsideredMethod() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testWithModifiedMockJdk/notConsideredMethod.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("throwableConstructor.kt")
|
||||
public void testThrowableConstructor() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testWithModifiedMockJdk/throwableConstructor.kt");
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,6 @@ package org.jetbrains.kotlin.generators.tests
|
||||
import org.jetbrains.kotlin.asJava.AbstractCompilerLightClassTest
|
||||
import org.jetbrains.kotlin.cfg.AbstractControlFlowTest
|
||||
import org.jetbrains.kotlin.cfg.AbstractDataFlowTest
|
||||
import org.jetbrains.kotlin.cfg.AbstractDiagnosticsWithModifiedMockJdkTest
|
||||
import org.jetbrains.kotlin.cfg.AbstractPseudoValueTest
|
||||
import org.jetbrains.kotlin.checkers.*
|
||||
import org.jetbrains.kotlin.checkers.javac.*
|
||||
@@ -80,10 +79,6 @@ fun main(args: Array<String>) {
|
||||
model("diagnostics/nativeTests")
|
||||
}
|
||||
|
||||
testClass<AbstractDiagnosticsWithModifiedMockJdkTest> {
|
||||
model("diagnostics/testWithModifiedMockJdk")
|
||||
}
|
||||
|
||||
testClass<AbstractDiagnosticsWithJdk15Test> {
|
||||
model("diagnostics/testsWithJava15")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user