diff --git a/idea/tests/org/jetbrains/jet/plugin/intentions/CodeTransformationTestGenerated.java b/idea/tests/org/jetbrains/jet/plugin/intentions/CodeTransformationTestGenerated.java index e0b3ada340a..8bae2dab3dd 100644 --- a/idea/tests/org/jetbrains/jet/plugin/intentions/CodeTransformationTestGenerated.java +++ b/idea/tests/org/jetbrains/jet/plugin/intentions/CodeTransformationTestGenerated.java @@ -16,22 +16,265 @@ package org.jetbrains.jet.plugin.intentions; -import junit.framework.Assert; import junit.framework.Test; import junit.framework.TestSuite; - -import java.io.File; -import java.util.regex.Pattern; import org.jetbrains.jet.JetTestUtils; import org.jetbrains.jet.test.InnerTestClasses; import org.jetbrains.jet.test.TestMetadata; -import org.jetbrains.jet.plugin.intentions.AbstractCodeTransformationTest; +import java.io.File; +import java.util.regex.Pattern; /** This class is generated by {@link org.jetbrains.jet.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ @SuppressWarnings("all") -@InnerTestClasses({CodeTransformationTestGenerated.ElvisToIfThen.class, CodeTransformationTestGenerated.IfThenToElvis.class, CodeTransformationTestGenerated.SafeAccessToIfThen.class, CodeTransformationTestGenerated.IfThenToSafeAccess.class, CodeTransformationTestGenerated.IfToAssignment.class, CodeTransformationTestGenerated.IfToReturn.class, CodeTransformationTestGenerated.IfToReturnAsymmetrically.class, CodeTransformationTestGenerated.WhenToAssignment.class, CodeTransformationTestGenerated.WhenToReturn.class, CodeTransformationTestGenerated.AssignmentToIf.class, CodeTransformationTestGenerated.AssignmentToWhen.class, CodeTransformationTestGenerated.PropertyToIf.class, CodeTransformationTestGenerated.PropertyToWhen.class, CodeTransformationTestGenerated.ReturnToIf.class, CodeTransformationTestGenerated.ReturnToWhen.class, CodeTransformationTestGenerated.IfToWhen.class, CodeTransformationTestGenerated.WhenToIf.class, CodeTransformationTestGenerated.Flatten.class, CodeTransformationTestGenerated.Merge.class, CodeTransformationTestGenerated.IntroduceSubject.class, CodeTransformationTestGenerated.EliminateSubject.class, CodeTransformationTestGenerated.Split.class, CodeTransformationTestGenerated.Join.class, CodeTransformationTestGenerated.ConvertMemberToExtension.class, CodeTransformationTestGenerated.ReconstructedType.class, CodeTransformationTestGenerated.RemoveUnnecessaryParentheses.class, CodeTransformationTestGenerated.ReplaceWithDotQualifiedMethodCall.class, CodeTransformationTestGenerated.ReplaceWithInfixFunctionCall.class, CodeTransformationTestGenerated.RemoveCurlyBracesFromTemplate.class, CodeTransformationTestGenerated.MoveLambdaInsideParentheses.class, CodeTransformationTestGenerated.MoveLambdaOutsideParentheses.class, CodeTransformationTestGenerated.ReplaceExplicitFunctionLiteralParamWithIt.class, CodeTransformationTestGenerated.ReplaceItWithExplicitFunctionLiteralParam.class, CodeTransformationTestGenerated.RemoveBraces.class, CodeTransformationTestGenerated.AddBraces.class, CodeTransformationTestGenerated.ReplaceGetIntention.class, CodeTransformationTestGenerated.ReplaceContainsIntention.class, CodeTransformationTestGenerated.ReplaceBinaryInfixIntention.class, CodeTransformationTestGenerated.ReplaceUnaryPrefixIntention.class, CodeTransformationTestGenerated.ReplaceInvokeIntention.class, CodeTransformationTestGenerated.SimplifyNegatedBinaryExpressionIntention.class, CodeTransformationTestGenerated.ConvertNegatedBooleanSequence.class, CodeTransformationTestGenerated.ConvertNegatedExpressionWithDemorgansLaw.class, CodeTransformationTestGenerated.SwapBinaryExpression.class, CodeTransformationTestGenerated.SplitIf.class, CodeTransformationTestGenerated.ReplaceWithOperatorAssign.class, CodeTransformationTestGenerated.ReplaceWithTraditionalAssignment.class, CodeTransformationTestGenerated.SimplifyBooleanWithConstants.class, CodeTransformationTestGenerated.InsertExplicitTypeArguments.class, CodeTransformationTestGenerated.RemoveExplicitTypeArguments.class, CodeTransformationTestGenerated.ConvertAssertToIf.class}) +@InnerTestClasses({CodeTransformationTestGenerated.DoubleBangToIfThen.class, CodeTransformationTestGenerated.IfThenToDoubleBang.class, CodeTransformationTestGenerated.ElvisToIfThen.class, CodeTransformationTestGenerated.IfThenToElvis.class, CodeTransformationTestGenerated.SafeAccessToIfThen.class, CodeTransformationTestGenerated.IfThenToSafeAccess.class, CodeTransformationTestGenerated.IfToAssignment.class, CodeTransformationTestGenerated.IfToReturn.class, CodeTransformationTestGenerated.IfToReturnAsymmetrically.class, CodeTransformationTestGenerated.WhenToAssignment.class, CodeTransformationTestGenerated.WhenToReturn.class, CodeTransformationTestGenerated.AssignmentToIf.class, CodeTransformationTestGenerated.AssignmentToWhen.class, CodeTransformationTestGenerated.PropertyToIf.class, CodeTransformationTestGenerated.PropertyToWhen.class, CodeTransformationTestGenerated.ReturnToIf.class, CodeTransformationTestGenerated.ReturnToWhen.class, CodeTransformationTestGenerated.IfToWhen.class, CodeTransformationTestGenerated.WhenToIf.class, CodeTransformationTestGenerated.Flatten.class, CodeTransformationTestGenerated.Merge.class, CodeTransformationTestGenerated.IntroduceSubject.class, CodeTransformationTestGenerated.EliminateSubject.class, CodeTransformationTestGenerated.Split.class, CodeTransformationTestGenerated.Join.class, CodeTransformationTestGenerated.ConvertMemberToExtension.class, CodeTransformationTestGenerated.ReconstructedType.class, CodeTransformationTestGenerated.RemoveUnnecessaryParentheses.class, CodeTransformationTestGenerated.ReplaceWithDotQualifiedMethodCall.class, CodeTransformationTestGenerated.ReplaceWithInfixFunctionCall.class, CodeTransformationTestGenerated.RemoveCurlyBracesFromTemplate.class, CodeTransformationTestGenerated.MoveLambdaInsideParentheses.class, CodeTransformationTestGenerated.MoveLambdaOutsideParentheses.class, CodeTransformationTestGenerated.ReplaceExplicitFunctionLiteralParamWithIt.class, CodeTransformationTestGenerated.ReplaceItWithExplicitFunctionLiteralParam.class, CodeTransformationTestGenerated.RemoveBraces.class, CodeTransformationTestGenerated.AddBraces.class, CodeTransformationTestGenerated.ReplaceGetIntention.class, CodeTransformationTestGenerated.ReplaceContainsIntention.class, CodeTransformationTestGenerated.ReplaceBinaryInfixIntention.class, CodeTransformationTestGenerated.ReplaceUnaryPrefixIntention.class, CodeTransformationTestGenerated.ReplaceInvokeIntention.class, CodeTransformationTestGenerated.SimplifyNegatedBinaryExpressionIntention.class, CodeTransformationTestGenerated.ConvertNegatedBooleanSequence.class, CodeTransformationTestGenerated.ConvertNegatedExpressionWithDemorgansLaw.class, CodeTransformationTestGenerated.SwapBinaryExpression.class, CodeTransformationTestGenerated.SplitIf.class, CodeTransformationTestGenerated.ReplaceWithOperatorAssign.class, CodeTransformationTestGenerated.ReplaceWithTraditionalAssignment.class, CodeTransformationTestGenerated.SimplifyBooleanWithConstants.class, CodeTransformationTestGenerated.InsertExplicitTypeArguments.class, CodeTransformationTestGenerated.RemoveExplicitTypeArguments.class, CodeTransformationTestGenerated.ConvertAssertToIf.class}) public class CodeTransformationTestGenerated extends AbstractCodeTransformationTest { + @TestMetadata("idea/testData/intentions/branched/doubleBangToIfThen") + public static class DoubleBangToIfThen extends AbstractCodeTransformationTest { + public void testAllFilesPresentInDoubleBangToIfThen() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("idea/testData/intentions/branched/doubleBangToIfThen"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("callExpression.kt") + public void testCallExpression() throws Exception { + doTestDoubleBangToIfThen("idea/testData/intentions/branched/doubleBangToIfThen/callExpression.kt"); + } + + @TestMetadata("callExpressionParens.kt") + public void testCallExpressionParens() throws Exception { + doTestDoubleBangToIfThen("idea/testData/intentions/branched/doubleBangToIfThen/callExpressionParens.kt"); + } + + @TestMetadata("exceptionTextEscapesQuotes.kt") + public void testExceptionTextEscapesQuotes() throws Exception { + doTestDoubleBangToIfThen("idea/testData/intentions/branched/doubleBangToIfThen/exceptionTextEscapesQuotes.kt"); + } + + @TestMetadata("exceptionTextHandlesMultiline.kt") + public void testExceptionTextHandlesMultiline() throws Exception { + doTestDoubleBangToIfThen("idea/testData/intentions/branched/doubleBangToIfThen/exceptionTextHandlesMultiline.kt"); + } + + @TestMetadata("localVal.kt") + public void testLocalVal() throws Exception { + doTestDoubleBangToIfThen("idea/testData/intentions/branched/doubleBangToIfThen/localVal.kt"); + } + + @TestMetadata("localVar.kt") + public void testLocalVar() throws Exception { + doTestDoubleBangToIfThen("idea/testData/intentions/branched/doubleBangToIfThen/localVar.kt"); + } + + @TestMetadata("simpleNameExpressionInParens.kt") + public void testSimpleNameExpressionInParens() throws Exception { + doTestDoubleBangToIfThen("idea/testData/intentions/branched/doubleBangToIfThen/simpleNameExpressionInParens.kt"); + } + + @TestMetadata("topLevelVal.kt") + public void testTopLevelVal() throws Exception { + doTestDoubleBangToIfThen("idea/testData/intentions/branched/doubleBangToIfThen/topLevelVal.kt"); + } + + @TestMetadata("topLevelValCustomGetter.kt") + public void testTopLevelValCustomGetter() throws Exception { + doTestDoubleBangToIfThen("idea/testData/intentions/branched/doubleBangToIfThen/topLevelValCustomGetter.kt"); + } + + @TestMetadata("topLevelVar.kt") + public void testTopLevelVar() throws Exception { + doTestDoubleBangToIfThen("idea/testData/intentions/branched/doubleBangToIfThen/topLevelVar.kt"); + } + + @TestMetadata("topLevelVarCustomGetter.kt") + public void testTopLevelVarCustomGetter() throws Exception { + doTestDoubleBangToIfThen("idea/testData/intentions/branched/doubleBangToIfThen/topLevelVarCustomGetter.kt"); + } + + @TestMetadata("usedInAssignment.kt") + public void testUsedInAssignment() throws Exception { + doTestDoubleBangToIfThen("idea/testData/intentions/branched/doubleBangToIfThen/usedInAssignment.kt"); + } + + } + + @TestMetadata("idea/testData/intentions/branched/ifThenToDoubleBang") + public static class IfThenToDoubleBang extends AbstractCodeTransformationTest { + @TestMetadata("acceptableEmptyElseBlockForStatement.kt") + public void testAcceptableEmptyElseBlockForStatement() throws Exception { + doTestIfThenToDoubleBang("idea/testData/intentions/branched/ifThenToDoubleBang/acceptableEmptyElseBlockForStatement.kt"); + } + + @TestMetadata("acceptableEmptyThenBlockForStatement.kt") + public void testAcceptableEmptyThenBlockForStatement() throws Exception { + doTestIfThenToDoubleBang("idea/testData/intentions/branched/ifThenToDoubleBang/acceptableEmptyThenBlockForStatement.kt"); + } + + @TestMetadata("acceptableWithoutElseBlockForStatementWithFun.kt") + public void testAcceptableWithoutElseBlockForStatementWithFun() throws Exception { + doTestIfThenToDoubleBang("idea/testData/intentions/branched/ifThenToDoubleBang/acceptableWithoutElseBlockForStatementWithFun.kt"); + } + + @TestMetadata("acceptableWithoutElseBlockForStatementWithVal.kt") + public void testAcceptableWithoutElseBlockForStatementWithVal() throws Exception { + doTestIfThenToDoubleBang("idea/testData/intentions/branched/ifThenToDoubleBang/acceptableWithoutElseBlockForStatementWithVal.kt"); + } + + public void testAllFilesPresentInIfThenToDoubleBang() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("idea/testData/intentions/branched/ifThenToDoubleBang"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("blockHasMoreThanOneStatement.kt") + public void testBlockHasMoreThanOneStatement() throws Exception { + doTestIfThenToDoubleBang("idea/testData/intentions/branched/ifThenToDoubleBang/blockHasMoreThanOneStatement.kt"); + } + + @TestMetadata("blockUsesDifferentVar.kt") + public void testBlockUsesDifferentVar() throws Exception { + doTestIfThenToDoubleBang("idea/testData/intentions/branched/ifThenToDoubleBang/blockUsesDifferentVar.kt"); + } + + @TestMetadata("conditionComparesNullWithNull.kt") + public void testConditionComparesNullWithNull() throws Exception { + doTestIfThenToDoubleBang("idea/testData/intentions/branched/ifThenToDoubleBang/conditionComparesNullWithNull.kt"); + } + + @TestMetadata("conditionInvalidBinaryExp.kt") + public void testConditionInvalidBinaryExp() throws Exception { + doTestIfThenToDoubleBang("idea/testData/intentions/branched/ifThenToDoubleBang/conditionInvalidBinaryExp.kt"); + } + + @TestMetadata("conditionNotBinaryExpr.kt") + public void testConditionNotBinaryExpr() throws Exception { + doTestIfThenToDoubleBang("idea/testData/intentions/branched/ifThenToDoubleBang/conditionNotBinaryExpr.kt"); + } + + @TestMetadata("doesNotinlineValueIfUsedMoreThanOnce.kt") + public void testDoesNotinlineValueIfUsedMoreThanOnce() throws Exception { + doTestIfThenToDoubleBang("idea/testData/intentions/branched/ifThenToDoubleBang/doesNotinlineValueIfUsedMoreThanOnce.kt"); + } + + @TestMetadata("doesNotinlineValueOutsideOfScope.kt") + public void testDoesNotinlineValueOutsideOfScope() throws Exception { + doTestIfThenToDoubleBang("idea/testData/intentions/branched/ifThenToDoubleBang/doesNotinlineValueOutsideOfScope.kt"); + } + + @TestMetadata("emptyCondition.kt") + public void testEmptyCondition() throws Exception { + doTestIfThenToDoubleBang("idea/testData/intentions/branched/ifThenToDoubleBang/emptyCondition.kt"); + } + + @TestMetadata("emptyElseBlock.kt") + public void testEmptyElseBlock() throws Exception { + doTestIfThenToDoubleBang("idea/testData/intentions/branched/ifThenToDoubleBang/emptyElseBlock.kt"); + } + + @TestMetadata("emptyThenBlock.kt") + public void testEmptyThenBlock() throws Exception { + doTestIfThenToDoubleBang("idea/testData/intentions/branched/ifThenToDoubleBang/emptyThenBlock.kt"); + } + + @TestMetadata("ifAndElseBothInBlocks.kt") + public void testIfAndElseBothInBlocks() throws Exception { + doTestIfThenToDoubleBang("idea/testData/intentions/branched/ifThenToDoubleBang/ifAndElseBothInBlocks.kt"); + } + + @TestMetadata("ifAndElseNotInBlocks.kt") + public void testIfAndElseNotInBlocks() throws Exception { + doTestIfThenToDoubleBang("idea/testData/intentions/branched/ifThenToDoubleBang/ifAndElseNotInBlocks.kt"); + } + + @TestMetadata("ifAsExpression.kt") + public void testIfAsExpression() throws Exception { + doTestIfThenToDoubleBang("idea/testData/intentions/branched/ifThenToDoubleBang/ifAsExpression.kt"); + } + + @TestMetadata("lhsEqualsNull.kt") + public void testLhsEqualsNull() throws Exception { + doTestIfThenToDoubleBang("idea/testData/intentions/branched/ifThenToDoubleBang/lhsEqualsNull.kt"); + } + + @TestMetadata("lhsNotEqualsNull.kt") + public void testLhsNotEqualsNull() throws Exception { + doTestIfThenToDoubleBang("idea/testData/intentions/branched/ifThenToDoubleBang/lhsNotEqualsNull.kt"); + } + + @TestMetadata("missingElseClause.kt") + public void testMissingElseClause() throws Exception { + doTestIfThenToDoubleBang("idea/testData/intentions/branched/ifThenToDoubleBang/missingElseClause.kt"); + } + + @TestMetadata("missingThenClause.kt") + public void testMissingThenClause() throws Exception { + doTestIfThenToDoubleBang("idea/testData/intentions/branched/ifThenToDoubleBang/missingThenClause.kt"); + } + + @TestMetadata("noCondition.kt") + public void testNoCondition() throws Exception { + doTestIfThenToDoubleBang("idea/testData/intentions/branched/ifThenToDoubleBang/noCondition.kt"); + } + + @TestMetadata("noNullInCondition.kt") + public void testNoNullInCondition() throws Exception { + doTestIfThenToDoubleBang("idea/testData/intentions/branched/ifThenToDoubleBang/noNullInCondition.kt"); + } + + @TestMetadata("notApplicableForFunction.kt") + public void testNotApplicableForFunction() throws Exception { + doTestIfThenToDoubleBang("idea/testData/intentions/branched/ifThenToDoubleBang/notApplicableForFunction.kt"); + } + + @TestMetadata("notApplicableForLocalVar.kt") + public void testNotApplicableForLocalVar() throws Exception { + doTestIfThenToDoubleBang("idea/testData/intentions/branched/ifThenToDoubleBang/notApplicableForLocalVar.kt"); + } + + @TestMetadata("nullBranchAlsoNull.kt") + public void testNullBranchAlsoNull() throws Exception { + doTestIfThenToDoubleBang("idea/testData/intentions/branched/ifThenToDoubleBang/nullBranchAlsoNull.kt"); + } + + @TestMetadata("otherBlockHasMoreThanOneStatement.kt") + public void testOtherBlockHasMoreThanOneStatement() throws Exception { + doTestIfThenToDoubleBang("idea/testData/intentions/branched/ifThenToDoubleBang/otherBlockHasMoreThanOneStatement.kt"); + } + + @TestMetadata("rhsEqualsNull.kt") + public void testRhsEqualsNull() throws Exception { + doTestIfThenToDoubleBang("idea/testData/intentions/branched/ifThenToDoubleBang/rhsEqualsNull.kt"); + } + + @TestMetadata("rhsNotEqualsNull.kt") + public void testRhsNotEqualsNull() throws Exception { + doTestIfThenToDoubleBang("idea/testData/intentions/branched/ifThenToDoubleBang/rhsNotEqualsNull.kt"); + } + + @TestMetadata("thenAndElseBothNull.kt") + public void testThenAndElseBothNull() throws Exception { + doTestIfThenToDoubleBang("idea/testData/intentions/branched/ifThenToDoubleBang/thenAndElseBothNull.kt"); + } + + @TestMetadata("throwByFqName.kt") + public void testThrowByFqName() throws Exception { + doTestIfThenToDoubleBang("idea/testData/intentions/branched/ifThenToDoubleBang/throwByFqName.kt"); + } + + @TestMetadata("unacceptableEmptyElseBlockForExpression.kt") + public void testUnacceptableEmptyElseBlockForExpression() throws Exception { + doTestIfThenToDoubleBang("idea/testData/intentions/branched/ifThenToDoubleBang/unacceptableEmptyElseBlockForExpression.kt"); + } + + @TestMetadata("unacceptableEmptyThenBlockForExpression.kt") + public void testUnacceptableEmptyThenBlockForExpression() throws Exception { + doTestIfThenToDoubleBang("idea/testData/intentions/branched/ifThenToDoubleBang/unacceptableEmptyThenBlockForExpression.kt"); + } + + @TestMetadata("willNotInlineClassProperty.kt") + public void testWillNotInlineClassProperty() throws Exception { + doTestIfThenToDoubleBang("idea/testData/intentions/branched/ifThenToDoubleBang/willNotInlineClassProperty.kt"); + } + + } + @TestMetadata("idea/testData/intentions/branched/elvisToIfThen") public static class ElvisToIfThen extends AbstractCodeTransformationTest { public void testAllFilesPresentInElvisToIfThen() throws Exception { @@ -207,6 +450,16 @@ public class CodeTransformationTestGenerated extends AbstractCodeTransformationT doTestIfThenToElvis("idea/testData/intentions/branched/ifThenToElvis/notApplicableForLocalVar.kt"); } + @TestMetadata("notApplicableForSimpleKotlinNPE.kt") + public void testNotApplicableForSimpleKotlinNPE() throws Exception { + doTestIfThenToElvis("idea/testData/intentions/branched/ifThenToElvis/notApplicableForSimpleKotlinNPE.kt"); + } + + @TestMetadata("notApplicableForSimpleNPE.kt") + public void testNotApplicableForSimpleNPE() throws Exception { + doTestIfThenToElvis("idea/testData/intentions/branched/ifThenToElvis/notApplicableForSimpleNPE.kt"); + } + @TestMetadata("nullBranchAlsoNull.kt") public void testNullBranchAlsoNull() throws Exception { doTestIfThenToElvis("idea/testData/intentions/branched/ifThenToElvis/nullBranchAlsoNull.kt"); @@ -232,6 +485,11 @@ public class CodeTransformationTestGenerated extends AbstractCodeTransformationT doTestIfThenToElvis("idea/testData/intentions/branched/ifThenToElvis/thenAndElseBothNull.kt"); } + @TestMetadata("throwsNPEwithArgument.kt") + public void testThrowsNPEwithArgument() throws Exception { + doTestIfThenToElvis("idea/testData/intentions/branched/ifThenToElvis/throwsNPEwithArgument.kt"); + } + @TestMetadata("willNotInlineClassProperty.kt") public void testWillNotInlineClassProperty() throws Exception { doTestIfThenToElvis("idea/testData/intentions/branched/ifThenToElvis/willNotInlineClassProperty.kt"); @@ -3625,6 +3883,8 @@ public class CodeTransformationTestGenerated extends AbstractCodeTransformationT public static Test suite() { TestSuite suite = new TestSuite("CodeTransformationTestGenerated"); + suite.addTestSuite(DoubleBangToIfThen.class); + suite.addTestSuite(IfThenToDoubleBang.class); suite.addTestSuite(ElvisToIfThen.class); suite.addTest(IfThenToElvis.innerSuite()); suite.addTestSuite(SafeAccessToIfThen.class);