FIR IDE: Generate quickfix tests related to ReplaceCallFix.

This commit is contained in:
Mark Punzalan
2021-02-26 22:23:26 +00:00
committed by Ilya Kirillov
parent 05deecaafa
commit 1b649fa4cb
4 changed files with 296 additions and 1 deletions
@@ -1138,9 +1138,11 @@ fun main(args: Array<String>) {
testClass<AbstractHighLevelQuickFixTest> {
val pattern = "^([\\w\\-_]+)\\.kt$"
model("quickfix/abstract", pattern = pattern, filenameStartsLowerCase = true)
model("quickfix/expressions", pattern = pattern, filenameStartsLowerCase = true)
model("quickfix/lateinit", pattern = pattern, filenameStartsLowerCase = true)
model("quickfix/modifiers", pattern = pattern, filenameStartsLowerCase = true, recursive = false)
model("quickfix/override/typeMismatchOnOverride", pattern = pattern, filenameStartsLowerCase = true, recursive = false)
model("quickfix/replaceWithSafeCall", pattern = pattern, filenameStartsLowerCase = true)
model("quickfix/variables/changeMutability", pattern = pattern, filenameStartsLowerCase = true)
}
@@ -197,6 +197,189 @@ public class HighLevelQuickFixTestGenerated extends AbstractHighLevelQuickFixTes
}
}
@TestMetadata("idea/testData/quickfix/expressions")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Expressions extends AbstractHighLevelQuickFixTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInExpressions() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/testData/quickfix/expressions"), Pattern.compile("^([\\w\\-_]+)\\.kt$"), null, true);
}
@TestMetadata("fixNullableBinaryWithExclExcl.kt")
public void testFixNullableBinaryWithExclExcl() throws Exception {
runTest("idea/testData/quickfix/expressions/fixNullableBinaryWithExclExcl.kt");
}
@TestMetadata("fixNullableInfixWithExclExcl.kt")
public void testFixNullableInfixWithExclExcl() throws Exception {
runTest("idea/testData/quickfix/expressions/fixNullableInfixWithExclExcl.kt");
}
@TestMetadata("fixNullableIterableGenericWithExclExcl.kt")
public void testFixNullableIterableGenericWithExclExcl() throws Exception {
runTest("idea/testData/quickfix/expressions/fixNullableIterableGenericWithExclExcl.kt");
}
@TestMetadata("fixNullableIterableWithExclExcl.kt")
public void testFixNullableIterableWithExclExcl() throws Exception {
runTest("idea/testData/quickfix/expressions/fixNullableIterableWithExclExcl.kt");
}
@TestMetadata("fixNullableUnaryWithExclExcl.kt")
public void testFixNullableUnaryWithExclExcl() throws Exception {
runTest("idea/testData/quickfix/expressions/fixNullableUnaryWithExclExcl.kt");
}
@TestMetadata("fixNullableWithExclExclAbsentWithBadIterator.kt")
public void testFixNullableWithExclExclAbsentWithBadIterator() throws Exception {
runTest("idea/testData/quickfix/expressions/fixNullableWithExclExclAbsentWithBadIterator.kt");
}
@TestMetadata("fixNullableWithIteratorWithExclExcl.kt")
public void testFixNullableWithIteratorWithExclExcl() throws Exception {
runTest("idea/testData/quickfix/expressions/fixNullableWithIteratorWithExclExcl.kt");
}
@TestMetadata("kt11594.kt")
public void testKt11594() throws Exception {
runTest("idea/testData/quickfix/expressions/kt11594.kt");
}
@TestMetadata("removeUselessCast.kt")
public void testRemoveUselessCast() throws Exception {
runTest("idea/testData/quickfix/expressions/removeUselessCast.kt");
}
@TestMetadata("removeUselessCastForLambdaInParens1.kt")
public void testRemoveUselessCastForLambdaInParens1() throws Exception {
runTest("idea/testData/quickfix/expressions/removeUselessCastForLambdaInParens1.kt");
}
@TestMetadata("removeUselessCastForLambdaInParens2.kt")
public void testRemoveUselessCastForLambdaInParens2() throws Exception {
runTest("idea/testData/quickfix/expressions/removeUselessCastForLambdaInParens2.kt");
}
@TestMetadata("removeUselessCastForLambdaInParens3.kt")
public void testRemoveUselessCastForLambdaInParens3() throws Exception {
runTest("idea/testData/quickfix/expressions/removeUselessCastForLambdaInParens3.kt");
}
@TestMetadata("removeUselessCastForLambdaInParens4.kt")
public void testRemoveUselessCastForLambdaInParens4() throws Exception {
runTest("idea/testData/quickfix/expressions/removeUselessCastForLambdaInParens4.kt");
}
@TestMetadata("removeUselessCastForLambdaInParens5.kt")
public void testRemoveUselessCastForLambdaInParens5() throws Exception {
runTest("idea/testData/quickfix/expressions/removeUselessCastForLambdaInParens5.kt");
}
@TestMetadata("removeUselessCastForLambdaInParens6.kt")
public void testRemoveUselessCastForLambdaInParens6() throws Exception {
runTest("idea/testData/quickfix/expressions/removeUselessCastForLambdaInParens6.kt");
}
@TestMetadata("removeUselessCastInParens.kt")
public void testRemoveUselessCastInParens() throws Exception {
runTest("idea/testData/quickfix/expressions/removeUselessCastInParens.kt");
}
@TestMetadata("removeUselessCastUnderSmartCast.kt")
public void testRemoveUselessCastUnderSmartCast() throws Exception {
runTest("idea/testData/quickfix/expressions/removeUselessCastUnderSmartCast.kt");
}
@TestMetadata("removeUselessIsCheck.kt")
public void testRemoveUselessIsCheck() throws Exception {
runTest("idea/testData/quickfix/expressions/removeUselessIsCheck.kt");
}
@TestMetadata("removeUselessIsCheckInWhen.kt")
public void testRemoveUselessIsCheckInWhen() throws Exception {
runTest("idea/testData/quickfix/expressions/removeUselessIsCheckInWhen.kt");
}
@TestMetadata("removeUselessIsCheckInWhenExpressionless.kt")
public void testRemoveUselessIsCheckInWhenExpressionless() throws Exception {
runTest("idea/testData/quickfix/expressions/removeUselessIsCheckInWhenExpressionless.kt");
}
@TestMetadata("removeUselessIsCheckInWhenExpressionlessNegate.kt")
public void testRemoveUselessIsCheckInWhenExpressionlessNegate() throws Exception {
runTest("idea/testData/quickfix/expressions/removeUselessIsCheckInWhenExpressionlessNegate.kt");
}
@TestMetadata("removeUselessIsCheckInWhenNegate.kt")
public void testRemoveUselessIsCheckInWhenNegate() throws Exception {
runTest("idea/testData/quickfix/expressions/removeUselessIsCheckInWhenNegate.kt");
}
@TestMetadata("removeUselessIsCheckNegate.kt")
public void testRemoveUselessIsCheckNegate() throws Exception {
runTest("idea/testData/quickfix/expressions/removeUselessIsCheckNegate.kt");
}
@TestMetadata("unnecessaryNonNullAssertion1.kt")
public void testUnnecessaryNonNullAssertion1() throws Exception {
runTest("idea/testData/quickfix/expressions/unnecessaryNonNullAssertion1.kt");
}
@TestMetadata("unnecessaryNonNullAssertion2.kt")
public void testUnnecessaryNonNullAssertion2() throws Exception {
runTest("idea/testData/quickfix/expressions/unnecessaryNonNullAssertion2.kt");
}
@TestMetadata("unnecessaryNonNullAssertion3.kt")
public void testUnnecessaryNonNullAssertion3() throws Exception {
runTest("idea/testData/quickfix/expressions/unnecessaryNonNullAssertion3.kt");
}
@TestMetadata("unnecessarySafeCall1.kt")
public void testUnnecessarySafeCall1() throws Exception {
runTest("idea/testData/quickfix/expressions/unnecessarySafeCall1.kt");
}
@TestMetadata("unsafeCall1.kt")
public void testUnsafeCall1() throws Exception {
runTest("idea/testData/quickfix/expressions/unsafeCall1.kt");
}
@TestMetadata("unsafeCall2.kt")
public void testUnsafeCall2() throws Exception {
runTest("idea/testData/quickfix/expressions/unsafeCall2.kt");
}
@TestMetadata("unsafeCall3.kt")
public void testUnsafeCall3() throws Exception {
runTest("idea/testData/quickfix/expressions/unsafeCall3.kt");
}
@TestMetadata("unsafeCall4.kt")
public void testUnsafeCall4() throws Exception {
runTest("idea/testData/quickfix/expressions/unsafeCall4.kt");
}
@TestMetadata("unsafeCall5.kt")
public void testUnsafeCall5() throws Exception {
runTest("idea/testData/quickfix/expressions/unsafeCall5.kt");
}
@TestMetadata("uselessCastStaticAssertIsFine.kt")
public void testUselessCastStaticAssertIsFine() throws Exception {
runTest("idea/testData/quickfix/expressions/uselessCastStaticAssertIsFine.kt");
}
@TestMetadata("uselessElvis.kt")
public void testUselessElvis() throws Exception {
runTest("idea/testData/quickfix/expressions/uselessElvis.kt");
}
}
@TestMetadata("idea/testData/quickfix/lateinit")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -686,6 +869,114 @@ public class HighLevelQuickFixTestGenerated extends AbstractHighLevelQuickFixTes
}
}
@TestMetadata("idea/testData/quickfix/replaceWithSafeCall")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class ReplaceWithSafeCall extends AbstractHighLevelQuickFixTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInReplaceWithSafeCall() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/testData/quickfix/replaceWithSafeCall"), Pattern.compile("^([\\w\\-_]+)\\.kt$"), null, true);
}
@TestMetadata("apply.kt")
public void testApply() throws Exception {
runTest("idea/testData/quickfix/replaceWithSafeCall/apply.kt");
}
@TestMetadata("applyWithImplicitParameter.kt")
public void testApplyWithImplicitParameter() throws Exception {
runTest("idea/testData/quickfix/replaceWithSafeCall/applyWithImplicitParameter.kt");
}
@TestMetadata("applyWithImplicitParameterFunctionCall.kt")
public void testApplyWithImplicitParameterFunctionCall() throws Exception {
runTest("idea/testData/quickfix/replaceWithSafeCall/applyWithImplicitParameterFunctionCall.kt");
}
@TestMetadata("assignment.kt")
public void testAssignment() throws Exception {
runTest("idea/testData/quickfix/replaceWithSafeCall/assignment.kt");
}
@TestMetadata("assignmentFromImplicitParameter.kt")
public void testAssignmentFromImplicitParameter() throws Exception {
runTest("idea/testData/quickfix/replaceWithSafeCall/assignmentFromImplicitParameter.kt");
}
@TestMetadata("assignmentToNullable.kt")
public void testAssignmentToNullable() throws Exception {
runTest("idea/testData/quickfix/replaceWithSafeCall/assignmentToNullable.kt");
}
@TestMetadata("assignmentToProperty.kt")
public void testAssignmentToProperty() throws Exception {
runTest("idea/testData/quickfix/replaceWithSafeCall/assignmentToProperty.kt");
}
@TestMetadata("comment.kt")
public void testComment() throws Exception {
runTest("idea/testData/quickfix/replaceWithSafeCall/comment.kt");
}
@TestMetadata("expression.kt")
public void testExpression() throws Exception {
runTest("idea/testData/quickfix/replaceWithSafeCall/expression.kt");
}
@TestMetadata("extFunction.kt")
public void testExtFunction() throws Exception {
runTest("idea/testData/quickfix/replaceWithSafeCall/extFunction.kt");
}
@TestMetadata("functionCall.kt")
public void testFunctionCall() throws Exception {
runTest("idea/testData/quickfix/replaceWithSafeCall/functionCall.kt");
}
@TestMetadata("hasElvis.kt")
public void testHasElvis() throws Exception {
runTest("idea/testData/quickfix/replaceWithSafeCall/hasElvis.kt");
}
@TestMetadata("hasElvis2.kt")
public void testHasElvis2() throws Exception {
runTest("idea/testData/quickfix/replaceWithSafeCall/hasElvis2.kt");
}
@TestMetadata("invokeOperator.kt")
public void testInvokeOperator() throws Exception {
runTest("idea/testData/quickfix/replaceWithSafeCall/invokeOperator.kt");
}
@TestMetadata("let.kt")
public void testLet() throws Exception {
runTest("idea/testData/quickfix/replaceWithSafeCall/let.kt");
}
@TestMetadata("letWithParameter.kt")
public void testLetWithParameter() throws Exception {
runTest("idea/testData/quickfix/replaceWithSafeCall/letWithParameter.kt");
}
@TestMetadata("lineBreak.kt")
public void testLineBreak() throws Exception {
runTest("idea/testData/quickfix/replaceWithSafeCall/lineBreak.kt");
}
@TestMetadata("noReplaceWithSafeCallForImplicitReceiver.kt")
public void testNoReplaceWithSafeCallForImplicitReceiver() throws Exception {
runTest("idea/testData/quickfix/replaceWithSafeCall/noReplaceWithSafeCallForImplicitReceiver.kt");
}
@TestMetadata("normal.kt")
public void testNormal() throws Exception {
runTest("idea/testData/quickfix/replaceWithSafeCall/normal.kt");
}
}
@TestMetadata("idea/testData/quickfix/variables/changeMutability")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -11,3 +11,4 @@ fun foo() {
val test: Some? = Some()
for (i in <caret>test) { }
}
/* FIR_COMPARISON */
@@ -10,4 +10,5 @@ class A {
fun A?.bar() {
<caret>foo()
}
}
/* FIR_COMPARISON */