mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Simplified CodeTransformationTest. Only one doTest method remains, intention class is moved to test data. Merged other intention tests (SpecifyTypeExplicitlyTest, ConvertToBlock/ExpressionBodyTest) into this one.
GitOrigin-RevId: 850220e6e6dead24366436f71eafad2a6f30393f
This commit is contained in:
committed by
intellij-monorepo-bot
parent
b572ccf3de
commit
c673de0eee
@@ -87,7 +87,6 @@ import org.jetbrains.jet.resolve.AbstractReferenceResolveInLibrarySourcesTest
|
||||
import org.jetbrains.jet.resolve.constraintSystem.AbstractConstraintSystemTest
|
||||
import org.jetbrains.jet.completion.AbstractCompiledKotlinInJavaCompletionTest
|
||||
import org.jetbrains.jet.completion.AbstractKotlinSourceInJavaCompletionTest
|
||||
import org.jetbrains.jet.plugin.intentions.AbstractIntentionTest
|
||||
import org.jetbrains.jet.checkers.AbstractJetDiagnosticsTestWithStdLib
|
||||
import org.jetbrains.jet.plugin.codeInsight.AbstractInsertImportOnPasteTest
|
||||
import org.jetbrains.jet.resolve.AbstractReferenceToJavaWithWrongFileStructureTest
|
||||
@@ -313,14 +312,6 @@ fun main(args: Array<String>) {
|
||||
model("quickfix", pattern = "^before(\\w+)\\.kt$")
|
||||
}
|
||||
|
||||
testClass(javaClass<AbstractIntentionTest>(), "ConvertToExpressionBodyTestGenerated") {
|
||||
model("intentions/convertToExpressionBody", pattern = "^before(\\w+)\\.kt$")
|
||||
}
|
||||
|
||||
testClass(javaClass<AbstractIntentionTest>(), "ConvertToBlockBodyTestGenerated") {
|
||||
model("intentions/convertToBlockBody", pattern = "^before(\\w+)\\.kt$")
|
||||
}
|
||||
|
||||
testClass(javaClass<AbstractJSBasicCompletionTest>()) {
|
||||
model("completion/basic/common")
|
||||
model("completion/basic/js")
|
||||
@@ -391,68 +382,7 @@ fun main(args: Array<String>) {
|
||||
}
|
||||
|
||||
testClass(javaClass<AbstractCodeTransformationTest>()) {
|
||||
model("intentions/branched/doubleBangToIfThen", testMethod = "doTestDoubleBangToIfThen")
|
||||
model("intentions/branched/ifThenToDoubleBang", testMethod = "doTestIfThenToDoubleBang")
|
||||
model("intentions/branched/elvisToIfThen", testMethod = "doTestElvisToIfThen")
|
||||
model("intentions/branched/ifThenToElvis", testMethod = "doTestIfThenToElvis")
|
||||
model("intentions/branched/safeAccessToIfThen", testMethod = "doTestSafeAccessToIfThen")
|
||||
model("intentions/branched/ifThenToSafeAccess", testMethod = "doTestIfThenToSafeAccess")
|
||||
model("intentions/branched/folding/ifToAssignment", testMethod = "doTestFoldIfToAssignment")
|
||||
model("intentions/branched/folding/ifToReturn", testMethod = "doTestFoldIfToReturn")
|
||||
model("intentions/branched/folding/ifToReturnAsymmetrically", testMethod = "doTestFoldIfToReturnAsymmetrically")
|
||||
model("intentions/branched/folding/whenToAssignment", testMethod = "doTestFoldWhenToAssignment")
|
||||
model("intentions/branched/folding/whenToReturn", testMethod = "doTestFoldWhenToReturn")
|
||||
model("intentions/branched/unfolding/assignmentToIf", testMethod = "doTestUnfoldAssignmentToIf")
|
||||
model("intentions/branched/unfolding/assignmentToWhen", testMethod = "doTestUnfoldAssignmentToWhen")
|
||||
model("intentions/branched/unfolding/propertyToIf", testMethod = "doTestUnfoldPropertyToIf")
|
||||
model("intentions/branched/unfolding/propertyToWhen", testMethod = "doTestUnfoldPropertyToWhen")
|
||||
model("intentions/branched/unfolding/returnToIf", testMethod = "doTestUnfoldReturnToIf")
|
||||
model("intentions/branched/unfolding/returnToWhen", testMethod = "doTestUnfoldReturnToWhen")
|
||||
model("intentions/branched/ifWhen/ifToWhen", testMethod = "doTestIfToWhen")
|
||||
model("intentions/branched/ifWhen/whenToIf", testMethod = "doTestWhenToIf")
|
||||
model("intentions/branched/when/flatten", testMethod = "doTestFlattenWhen")
|
||||
model("intentions/branched/when/merge", testMethod = "doTestMergeWhen")
|
||||
model("intentions/branched/when/introduceSubject", testMethod = "doTestIntroduceWhenSubject")
|
||||
model("intentions/branched/when/eliminateSubject", testMethod = "doTestEliminateWhenSubject")
|
||||
model("intentions/declarations/split", testMethod = "doTestSplitProperty")
|
||||
model("intentions/declarations/convertMemberToExtension", testMethod = "doTestConvertMemberToExtension")
|
||||
model("intentions/reconstructedType", testMethod = "doTestReconstructType")
|
||||
model("intentions/removeUnnecessaryParentheses", testMethod = "doTestRemoveUnnecessaryParentheses")
|
||||
model("intentions/replaceWithDotQualifiedMethodCall", testMethod = "doTestReplaceWithDotQualifiedMethodCall")
|
||||
model("intentions/replaceWithInfixFunctionCall", testMethod = "doTestReplaceWithInfixFunctionCall")
|
||||
model("intentions/removeCurlyBracesFromTemplate", testMethod = "doTestRemoveCurlyFromTemplate")
|
||||
model("intentions/convertToStringTemplateIntention", testMethod = "doTestConvertToStringTemplate")
|
||||
model("intentions/convertToConcatenatedStringIntention", testMethod = "doTestConvertToConcatenatedStringIntention")
|
||||
model("intentions/insertCurlyBracestsToTemplate", testMethod = "doTestInsertCurlyToTemplate")
|
||||
model("intentions/moveLambdaInsideParentheses", testMethod = "doTestMoveLambdaInsideParentheses")
|
||||
model("intentions/moveLambdaOutsideParentheses", testMethod = "doTestMoveLambdaOutsideParentheses")
|
||||
model("intentions/replaceExplicitFunctionLiteralParamWithIt", testMethod = "doTestReplaceExplicitFunctionLiteralParamWithIt")
|
||||
model("intentions/replaceItWithExplicitFunctionLiteralParam", testMethod = "doTestReplaceItWithExplicitFunctionLiteralParam")
|
||||
model("intentions/removeBraces", testMethod = "doTestRemoveBraces")
|
||||
model("intentions/addBraces", testMethod = "doTestAddBraces")
|
||||
model("intentions/attributeCallReplacements/replaceGetIntention", testMethod = "doTestReplaceGetIntention")
|
||||
model("intentions/attributeCallReplacements/replaceContainsIntention", testMethod = "doTestReplaceContainsIntention")
|
||||
model("intentions/attributeCallReplacements/replaceBinaryInfixIntention", testMethod = "doTestReplaceBinaryInfixIntention")
|
||||
model("intentions/attributeCallReplacements/replaceUnaryPrefixIntention", testMethod = "doTestReplaceUnaryPrefixIntention")
|
||||
model("intentions/attributeCallReplacements/replaceInvokeIntention", testMethod = "doTestReplaceInvokeIntention")
|
||||
model("intentions/simplifyNegatedBinaryExpressionIntention", testMethod = "doTestSimplifyNegatedBinaryExpressionIntention")
|
||||
model("intentions/convertNegatedBooleanSequence", testMethod="doTestConvertNegatedBooleanSequence")
|
||||
model("intentions/convertNegatedExpressionWithDemorgansLaw", testMethod = "doTestConvertNegatedExpressionWithDemorgansLaw")
|
||||
model("intentions/swapBinaryExpression", testMethod = "doTestSwapBinaryExpression")
|
||||
model("intentions/splitIf", testMethod = "doTestSplitIf")
|
||||
model("intentions/replaceWithOperatorAssign", testMethod = "doTestReplaceWithOperatorAssign")
|
||||
model("intentions/replaceWithTraditionalAssignment", testMethod = "doTestReplaceWithTraditionalAssignment")
|
||||
model("intentions/simplifyBooleanWithConstants", testMethod = "doTestSimplifyBooleanWithConstants")
|
||||
model("intentions/insertExplicitTypeArguments", testMethod = "doTestInsertExplicitTypeArguments")
|
||||
model("intentions/removeExplicitTypeArguments", testMethod = "doTestRemoveExplicitTypeArguments")
|
||||
model("intentions/convertAssertToIf", testMethod = "doTestConvertAssertToIfWithThrowIntention")
|
||||
model("intentions/convertIfToAssert", testMethod = "doTestConvertIfWithThrowToAssertIntention")
|
||||
model("intentions/makeTypeExplicitInLambda", testMethod = "doTestMakeTypeExplicitInLambda")
|
||||
model("intentions/makeTypeImplicitInLambda", testMethod = "doTestMakeTypeImplicitInLambda")
|
||||
model("intentions/invertIfCondition", testMethod = "doTestInvertIfCondition")
|
||||
model("intentions/operatorToFunction", testMethod = "doTestOperatorToFunction")
|
||||
model("intentions/convertToForEachLoop", testMethod = "doTestConvertToForEachLoop")
|
||||
model("intentions/convertToForEachFunctionCall", testMethod = "doTestConvertToForEachFunctionCall")
|
||||
model("intentions", testMethod = "doTest")
|
||||
}
|
||||
|
||||
testClass(javaClass<AbstractJetInspectionTest>()) {
|
||||
|
||||
+31
-253
@@ -16,277 +16,55 @@
|
||||
|
||||
package org.jetbrains.jet.plugin.intentions;
|
||||
|
||||
import com.intellij.codeInsight.editorActions.JoinLinesHandler;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer;
|
||||
import com.intellij.codeInsight.daemon.impl.DaemonCodeAnalyzerImpl;
|
||||
import com.intellij.codeInsight.intention.IntentionAction;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
|
||||
import com.intellij.openapi.projectRoots.JavaSdk;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.testFramework.LightCodeInsightTestCase;
|
||||
import com.intellij.util.PathUtil;
|
||||
import org.apache.commons.lang.SystemUtils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.InTextDirectivesUtils;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.plugin.DirectiveBasedActionUtils;
|
||||
import org.jetbrains.jet.plugin.intentions.branchedTransformations.intentions.*;
|
||||
import org.jetbrains.jet.plugin.intentions.declarations.ConvertMemberToExtension;
|
||||
import org.jetbrains.jet.plugin.intentions.declarations.SplitPropertyDeclarationIntention;
|
||||
import org.jetbrains.jet.plugin.PluginTestCaseBase;
|
||||
import org.jetbrains.jet.testing.ConfigLibraryUtil;
|
||||
import org.junit.Assert;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class AbstractCodeTransformationTest extends LightCodeInsightTestCase {
|
||||
public void doTestDoubleBangToIfThen(@NotNull String path) throws Exception {
|
||||
doTestIntention(path, new DoubleBangToIfThenIntention());
|
||||
private static IntentionAction createIntention(File testDataFile) throws Exception {
|
||||
List<File> candidateFiles = Lists.newArrayList();
|
||||
|
||||
File current = testDataFile.getParentFile();
|
||||
while (current != null) {
|
||||
File candidate = new File(current, ".intention");
|
||||
if (candidate.exists()) {
|
||||
candidateFiles.add(candidate);
|
||||
}
|
||||
current = current.getParentFile();
|
||||
}
|
||||
|
||||
if (candidateFiles.isEmpty()) {
|
||||
throw new AssertionError(".intention file is not found for " + testDataFile +
|
||||
"\nAdd it to base directory of test data. It should contain fully-qualified name of intention class.");
|
||||
}
|
||||
if (candidateFiles.size() > 1) {
|
||||
throw new AssertionError("Several .intention files are available for " + testDataFile +
|
||||
"\nPlease remove some of them\n" + candidateFiles);
|
||||
}
|
||||
|
||||
String className = FileUtil.loadFile(candidateFiles.get(0)).trim();
|
||||
return (IntentionAction) Class.forName(className).newInstance();
|
||||
}
|
||||
|
||||
public void doTestIfThenToDoubleBang(@NotNull String path) throws Exception {
|
||||
doTestIntention(path, new IfThenToDoubleBangIntention());
|
||||
}
|
||||
protected void doTest(@NotNull String path) throws Exception {
|
||||
IntentionAction intentionAction = createIntention(new File(path));
|
||||
|
||||
public void doTestElvisToIfThen(@NotNull String path) throws Exception {
|
||||
doTestIntention(path, new ElvisToIfThenIntention());
|
||||
}
|
||||
|
||||
public void doTestIfThenToElvis(@NotNull String path) throws Exception {
|
||||
doTestIntention(path, new IfThenToElvisIntention());
|
||||
}
|
||||
|
||||
public void doTestSafeAccessToIfThen(@NotNull String path) throws Exception {
|
||||
doTestIntention(path, new SafeAccessToIfThenIntention());
|
||||
}
|
||||
|
||||
public void doTestIfThenToSafeAccess(@NotNull String path) throws Exception {
|
||||
doTestIntention(path, new IfThenToSafeAccessIntention());
|
||||
}
|
||||
|
||||
public void doTestConvertToStringTemplate(@NotNull String path) throws Exception {
|
||||
doTestIntention(path, new ConvertToStringTemplateIntention());
|
||||
}
|
||||
|
||||
public void doTestConvertToConcatenatedStringIntention(@NotNull String path) throws Exception {
|
||||
doTestIntention(path, new ConvertToConcatenatedStringIntention());
|
||||
}
|
||||
|
||||
public void doTestFoldIfToAssignment(@NotNull String path) throws Exception {
|
||||
doTestIntention(path, new FoldIfToAssignmentIntention());
|
||||
}
|
||||
|
||||
public void doTestFoldIfToReturn(@NotNull String path) throws Exception {
|
||||
doTestIntention(path, new FoldIfToReturnIntention());
|
||||
}
|
||||
|
||||
public void doTestFoldIfToReturnAsymmetrically(@NotNull String path) throws Exception {
|
||||
doTestIntention(path, new FoldIfToReturnAsymmetricallyIntention());
|
||||
}
|
||||
|
||||
public void doTestFoldWhenToAssignment(@NotNull String path) throws Exception {
|
||||
doTestIntention(path, new FoldWhenToAssignmentIntention());
|
||||
}
|
||||
|
||||
public void doTestFoldWhenToReturn(@NotNull String path) throws Exception {
|
||||
doTestIntention(path, new FoldWhenToReturnIntention());
|
||||
}
|
||||
|
||||
public void doTestUnfoldAssignmentToIf(@NotNull String path) throws Exception {
|
||||
doTestIntention(path, new UnfoldAssignmentToIfIntention());
|
||||
}
|
||||
|
||||
public void doTestUnfoldAssignmentToWhen(@NotNull String path) throws Exception {
|
||||
doTestIntention(path, new UnfoldAssignmentToWhenIntention());
|
||||
}
|
||||
|
||||
public void doTestUnfoldPropertyToIf(@NotNull String path) throws Exception {
|
||||
doTestIntention(path, new UnfoldPropertyToIfIntention());
|
||||
}
|
||||
|
||||
public void doTestUnfoldPropertyToWhen(@NotNull String path) throws Exception {
|
||||
doTestIntention(path, new UnfoldPropertyToWhenIntention());
|
||||
}
|
||||
|
||||
public void doTestUnfoldReturnToIf(@NotNull String path) throws Exception {
|
||||
doTestIntention(path, new UnfoldReturnToIfIntention());
|
||||
}
|
||||
|
||||
public void doTestUnfoldReturnToWhen(@NotNull String path) throws Exception {
|
||||
doTestIntention(path, new UnfoldReturnToWhenIntention());
|
||||
}
|
||||
|
||||
public void doTestIfToWhen(@NotNull String path) throws Exception {
|
||||
doTestIntention(path, new IfToWhenIntention());
|
||||
}
|
||||
|
||||
public void doTestWhenToIf(@NotNull String path) throws Exception {
|
||||
doTestIntention(path, new WhenToIfIntention());
|
||||
}
|
||||
|
||||
public void doTestFlattenWhen(@NotNull String path) throws Exception {
|
||||
doTestIntention(path, new FlattenWhenIntention());
|
||||
}
|
||||
|
||||
public void doTestMergeWhen(@NotNull String path) throws Exception {
|
||||
doTestIntention(path, new MergeWhenIntention());
|
||||
}
|
||||
|
||||
public void doTestIntroduceWhenSubject(@NotNull String path) throws Exception {
|
||||
doTestIntention(path, new IntroduceWhenSubjectIntention());
|
||||
}
|
||||
|
||||
public void doTestEliminateWhenSubject(@NotNull String path) throws Exception {
|
||||
doTestIntention(path, new EliminateWhenSubjectIntention());
|
||||
}
|
||||
|
||||
public void doTestSplitProperty(@NotNull String path) throws Exception {
|
||||
doTestIntention(path, new SplitPropertyDeclarationIntention());
|
||||
}
|
||||
|
||||
public void doTestRemoveUnnecessaryParentheses(@NotNull String path) throws Exception {
|
||||
doTestIntention(path, new RemoveUnnecessaryParenthesesIntention());
|
||||
}
|
||||
|
||||
public void doTestRemoveCurlyFromTemplate(@NotNull String path) throws Exception {
|
||||
doTestIntention(path, new RemoveCurlyBracesFromTemplateIntention());
|
||||
}
|
||||
|
||||
public void doTestInsertCurlyToTemplate(@NotNull String path) throws Exception {
|
||||
doTestIntention(path, new InsertCurlyBracesToTemplateIntention());
|
||||
}
|
||||
|
||||
public void doTestMoveLambdaInsideParentheses(@NotNull String path) throws Exception {
|
||||
doTestIntention(path, new MoveLambdaInsideParenthesesIntention());
|
||||
}
|
||||
public void doTestMoveLambdaOutsideParentheses(@NotNull String path) throws Exception {
|
||||
doTestIntention(path, new MoveLambdaOutsideParenthesesIntention());
|
||||
}
|
||||
|
||||
public void doTestSwapBinaryExpression(@NotNull String path) throws Exception {
|
||||
doTestIntention(path, new SwapBinaryExpression());
|
||||
}
|
||||
|
||||
public void doTestRemoveExplicitTypeArguments(@NotNull String path) throws Exception {
|
||||
doTestIntention(path, new RemoveExplicitTypeArguments());
|
||||
}
|
||||
|
||||
public void doTestConvertMemberToExtension(@NotNull String path) throws Exception {
|
||||
doTestIntention(path, new ConvertMemberToExtension());
|
||||
}
|
||||
|
||||
public void doTestReconstructType(@NotNull String path) throws Exception {
|
||||
doTestIntention(path, new ReconstructTypeInCastOrIsAction());
|
||||
}
|
||||
|
||||
public void doTestReplaceWithDotQualifiedMethodCall(@NotNull String path) throws Exception {
|
||||
doTestIntention(path, new ReplaceWithDotQualifiedMethodCallIntention());
|
||||
}
|
||||
|
||||
public void doTestReplaceWithInfixFunctionCall(@NotNull String path) throws Exception {
|
||||
doTestIntention(path, new TestableReplaceWithInfixFunctionCallIntention());
|
||||
}
|
||||
|
||||
public void doTestReplaceExplicitFunctionLiteralParamWithIt(@NotNull String path) throws Exception {
|
||||
doTestIntention(path, new ReplaceExplicitFunctionLiteralParamWithItIntention());
|
||||
}
|
||||
|
||||
public void doTestConvertNegatedExpressionWithDemorgansLaw(@NotNull String path) throws Exception {
|
||||
doTestIntention(path, new ConvertNegatedExpressionWithDemorgansLawIntention());
|
||||
}
|
||||
|
||||
public void doTestReplaceItWithExplicitFunctionLiteralParam(@NotNull String path) throws Exception {
|
||||
doTestIntention(path, new ReplaceItWithExplicitFunctionLiteralParamIntention());
|
||||
}
|
||||
|
||||
public void doTestRemoveBraces(@NotNull String path) throws Exception {
|
||||
doTestIntention(path, new RemoveBracesIntention());
|
||||
}
|
||||
|
||||
public void doTestAddBraces(@NotNull String path) throws Exception {
|
||||
doTestIntention(path, new AddBracesIntention());
|
||||
}
|
||||
|
||||
public void doTestConvertNegatedBooleanSequence(@NotNull String path) throws Exception {
|
||||
doTestIntention(path, new ConvertNegatedBooleanSequenceIntention());
|
||||
}
|
||||
|
||||
public void doTestReplaceGetIntention(@NotNull String path) throws Exception {
|
||||
doTestIntention(path, new TestableReplaceGetIntention());
|
||||
}
|
||||
|
||||
public void doTestReplaceContainsIntention(@NotNull String path) throws Exception {
|
||||
doTestIntention(path, new TestableReplaceContainsIntention());
|
||||
}
|
||||
|
||||
public void doTestReplaceBinaryInfixIntention(@NotNull String path) throws Exception {
|
||||
doTestIntention(path, new TestableReplaceBinaryInfixIntention());
|
||||
}
|
||||
|
||||
public void doTestReplaceUnaryPrefixIntention(@NotNull String path) throws Exception {
|
||||
doTestIntention(path, new TestableReplaceUnaryPrefixIntention());
|
||||
}
|
||||
|
||||
public void doTestReplaceInvokeIntention(@NotNull String path) throws Exception {
|
||||
doTestIntention(path, new TestableReplaceInvokeIntention());
|
||||
}
|
||||
|
||||
public void doTestSimplifyNegatedBinaryExpressionIntention(@NotNull String path) throws Exception {
|
||||
doTestIntention(path, new SimplifyNegatedBinaryExpressionIntention());
|
||||
}
|
||||
|
||||
public void doTestInsertExplicitTypeArguments(@NotNull String path) throws Exception {
|
||||
doTestIntention(path, new InsertExplicitTypeArguments());
|
||||
}
|
||||
|
||||
public void doTestConvertAssertToIfWithThrowIntention(@NotNull String path) throws Exception {
|
||||
doTestIntention(path, new ConvertAssertToIfWithThrowIntention());
|
||||
}
|
||||
|
||||
public void doTestConvertIfWithThrowToAssertIntention(@NotNull String path) throws Exception {
|
||||
doTestIntention(path, new ConvertIfWithThrowToAssertIntention());
|
||||
}
|
||||
|
||||
public void doTestSplitIf(@NotNull String path) throws Exception {
|
||||
doTestIntention(path, new SplitIfIntention());
|
||||
}
|
||||
|
||||
public void doTestReplaceWithOperatorAssign(@NotNull String path) throws Exception {
|
||||
doTestIntention(path, new ReplaceWithOperatorAssignIntention());
|
||||
}
|
||||
|
||||
public void doTestReplaceWithTraditionalAssignment(@NotNull String path) throws Exception {
|
||||
doTestIntention(path, new ReplaceWithTraditionalAssignmentIntention());
|
||||
}
|
||||
|
||||
public void doTestSimplifyBooleanWithConstants(@NotNull String path) throws Exception {
|
||||
doTestIntention(path, new SimplifyBooleanWithConstantsIntention());
|
||||
}
|
||||
|
||||
public void doTestInvertIfCondition(@NotNull String path) throws Exception {
|
||||
doTestIntention(path, new InvertIfConditionIntention());
|
||||
}
|
||||
|
||||
public void doTestMakeTypeExplicitInLambda(@NotNull String path) throws Exception {
|
||||
doTestIntention(path, new MakeTypeExplicitInLambdaIntention());
|
||||
}
|
||||
|
||||
public void doTestMakeTypeImplicitInLambda(@NotNull String path) throws Exception {
|
||||
doTestIntention(path, new MakeTypeImplicitInLambdaIntention());
|
||||
}
|
||||
|
||||
public void doTestOperatorToFunction(@NotNull String path) throws Exception {
|
||||
doTestIntention(path, new OperatorToFunctionIntention());
|
||||
}
|
||||
|
||||
public void doTestConvertToForEachLoop(@NotNull String path) throws Exception {
|
||||
doTestIntention(path, new ConvertToForEachLoopIntention());
|
||||
}
|
||||
|
||||
public void doTestConvertToForEachFunctionCall(@NotNull String path) throws Exception {
|
||||
doTestIntention(path, new ConvertToForEachFunctionCallIntention());
|
||||
}
|
||||
|
||||
private void doTestIntention(@NotNull String path, @NotNull IntentionAction intentionAction) throws Exception {
|
||||
configureByFile(path);
|
||||
|
||||
String fileText = FileUtil.loadFile(new File(path), true);
|
||||
@@ -351,6 +129,6 @@ public abstract class AbstractCodeTransformationTest extends LightCodeInsightTes
|
||||
}
|
||||
|
||||
protected static Sdk getFullJavaJDK() {
|
||||
return JavaSdk.getInstance().createJdk("JDK", SystemUtils.getJavaHome().getAbsolutePath());
|
||||
return PluginTestCaseBase.fullJdk();
|
||||
}
|
||||
}
|
||||
|
||||
-22
@@ -1,22 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2014 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.jet.plugin.intentions;
|
||||
|
||||
import org.jetbrains.jet.plugin.quickfix.AbstractQuickFixTest;
|
||||
|
||||
public abstract class AbstractIntentionTest extends AbstractQuickFixTest{
|
||||
}
|
||||
+4540
-4153
File diff suppressed because it is too large
Load Diff
-104
@@ -1,104 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2014 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.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.AbstractIntentionTest;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.jet.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("idea/testData/intentions/convertToBlockBody")
|
||||
public class ConvertToBlockBodyTestGenerated extends AbstractIntentionTest {
|
||||
public void testAllFilesPresentInConvertToBlockBody() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("idea/testData/intentions/convertToBlockBody"), Pattern.compile("^before(\\w+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("beforeExplicitlyNonUnitFun.kt")
|
||||
public void testExplicitlyNonUnitFun() throws Exception {
|
||||
doTest("idea/testData/intentions/convertToBlockBody/beforeExplicitlyNonUnitFun.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeExplicitlyTypedFunWithUnresolvedExpression.kt")
|
||||
public void testExplicitlyTypedFunWithUnresolvedExpression() throws Exception {
|
||||
doTest("idea/testData/intentions/convertToBlockBody/beforeExplicitlyTypedFunWithUnresolvedExpression.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeExplicitlyTypedFunWithUnresolvedType.kt")
|
||||
public void testExplicitlyTypedFunWithUnresolvedType() throws Exception {
|
||||
doTest("idea/testData/intentions/convertToBlockBody/beforeExplicitlyTypedFunWithUnresolvedType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeExplicitlyUnitFun.kt")
|
||||
public void testExplicitlyUnitFun() throws Exception {
|
||||
doTest("idea/testData/intentions/convertToBlockBody/beforeExplicitlyUnitFun.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeExplicitlyUnitFunWithUnresolvedExpression.kt")
|
||||
public void testExplicitlyUnitFunWithUnresolvedExpression() throws Exception {
|
||||
doTest("idea/testData/intentions/convertToBlockBody/beforeExplicitlyUnitFunWithUnresolvedExpression.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeFunWithThrow.kt")
|
||||
public void testFunWithThrow() throws Exception {
|
||||
doTest("idea/testData/intentions/convertToBlockBody/beforeFunWithThrow.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeGetter.kt")
|
||||
public void testGetter() throws Exception {
|
||||
doTest("idea/testData/intentions/convertToBlockBody/beforeGetter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeGetterWithThrow.kt")
|
||||
public void testGetterWithThrow() throws Exception {
|
||||
doTest("idea/testData/intentions/convertToBlockBody/beforeGetterWithThrow.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeImplicitlyNonUnitFun.kt")
|
||||
public void testImplicitlyNonUnitFun() throws Exception {
|
||||
doTest("idea/testData/intentions/convertToBlockBody/beforeImplicitlyNonUnitFun.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeImplicitlyTypedFunWithUnresolvedType.kt")
|
||||
public void testImplicitlyTypedFunWithUnresolvedType() throws Exception {
|
||||
doTest("idea/testData/intentions/convertToBlockBody/beforeImplicitlyTypedFunWithUnresolvedType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeImplicitlyUnitFun.kt")
|
||||
public void testImplicitlyUnitFun() throws Exception {
|
||||
doTest("idea/testData/intentions/convertToBlockBody/beforeImplicitlyUnitFun.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeNothingFun.kt")
|
||||
public void testNothingFun() throws Exception {
|
||||
doTest("idea/testData/intentions/convertToBlockBody/beforeNothingFun.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeSetter.kt")
|
||||
public void testSetter() throws Exception {
|
||||
doTest("idea/testData/intentions/convertToBlockBody/beforeSetter.kt");
|
||||
}
|
||||
|
||||
}
|
||||
-124
@@ -1,124 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2014 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.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.AbstractIntentionTest;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.jet.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("idea/testData/intentions/convertToExpressionBody")
|
||||
public class ConvertToExpressionBodyTestGenerated extends AbstractIntentionTest {
|
||||
public void testAllFilesPresentInConvertToExpressionBody() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("idea/testData/intentions/convertToExpressionBody"), Pattern.compile("^before(\\w+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("beforeAnonymousObjectExpression.kt")
|
||||
public void testAnonymousObjectExpression() throws Exception {
|
||||
doTest("idea/testData/intentions/convertToExpressionBody/beforeAnonymousObjectExpression.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeAssignment.kt")
|
||||
public void testAssignment() throws Exception {
|
||||
doTest("idea/testData/intentions/convertToExpressionBody/beforeAssignment.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeDeclaration.kt")
|
||||
public void testDeclaration() throws Exception {
|
||||
doTest("idea/testData/intentions/convertToExpressionBody/beforeDeclaration.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeExpressionWithReturns1.kt")
|
||||
public void testExpressionWithReturns1() throws Exception {
|
||||
doTest("idea/testData/intentions/convertToExpressionBody/beforeExpressionWithReturns1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeExpressionWithReturns2.kt")
|
||||
public void testExpressionWithReturns2() throws Exception {
|
||||
doTest("idea/testData/intentions/convertToExpressionBody/beforeExpressionWithReturns2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeFunWithImplicitUnitTypeWithThrow.kt")
|
||||
public void testFunWithImplicitUnitTypeWithThrow() throws Exception {
|
||||
doTest("idea/testData/intentions/convertToExpressionBody/beforeFunWithImplicitUnitTypeWithThrow.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeFunWithNoBlock.kt")
|
||||
public void testFunWithNoBlock() throws Exception {
|
||||
doTest("idea/testData/intentions/convertToExpressionBody/beforeFunWithNoBlock.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeFunWithNothingType.kt")
|
||||
public void testFunWithNothingType() throws Exception {
|
||||
doTest("idea/testData/intentions/convertToExpressionBody/beforeFunWithNothingType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeFunWithReturn.kt")
|
||||
public void testFunWithReturn() throws Exception {
|
||||
doTest("idea/testData/intentions/convertToExpressionBody/beforeFunWithReturn.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeFunWithUnitType.kt")
|
||||
public void testFunWithUnitType() throws Exception {
|
||||
doTest("idea/testData/intentions/convertToExpressionBody/beforeFunWithUnitType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeFunWithUnitType2.kt")
|
||||
public void testFunWithUnitType2() throws Exception {
|
||||
doTest("idea/testData/intentions/convertToExpressionBody/beforeFunWithUnitType2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeFunWithUnitTypeWithThrow.kt")
|
||||
public void testFunWithUnitTypeWithThrow() throws Exception {
|
||||
doTest("idea/testData/intentions/convertToExpressionBody/beforeFunWithUnitTypeWithThrow.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeFunctionLiteral.kt")
|
||||
public void testFunctionLiteral() throws Exception {
|
||||
doTest("idea/testData/intentions/convertToExpressionBody/beforeFunctionLiteral.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeGetWithReturn.kt")
|
||||
public void testGetWithReturn() throws Exception {
|
||||
doTest("idea/testData/intentions/convertToExpressionBody/beforeGetWithReturn.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeMultipleStatements.kt")
|
||||
public void testMultipleStatements() throws Exception {
|
||||
doTest("idea/testData/intentions/convertToExpressionBody/beforeMultipleStatements.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeReturnWithNoValue.kt")
|
||||
public void testReturnWithNoValue() throws Exception {
|
||||
doTest("idea/testData/intentions/convertToExpressionBody/beforeReturnWithNoValue.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeWhile.kt")
|
||||
public void testWhile() throws Exception {
|
||||
doTest("idea/testData/intentions/convertToExpressionBody/beforeWhile.kt");
|
||||
}
|
||||
|
||||
}
|
||||
-92
@@ -1,92 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2013 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.jet.plugin.intentions;
|
||||
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.plugin.PluginTestCaseBase;
|
||||
import org.jetbrains.jet.plugin.quickfix.AbstractQuickFixTest;
|
||||
|
||||
public class SpecifyTypeExplicitlyTest extends AbstractQuickFixTest {
|
||||
public void testBadCaretPosition() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testClassNameClashing() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testFunctionType() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testStringRedefined() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testTypeAlreadyProvided() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testUnitType() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testUnknownType() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testLoopParameter() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testOnType() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testEnumType() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testRemoveUnresolvedType() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testPublicMember() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTestDataPath() {
|
||||
return PluginTestCaseBase.getTestDataPathBase() + "/intentions/";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Sdk getProjectJDK() {
|
||||
return PluginTestCaseBase.jdkFromIdeaHome();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getBasePath() {
|
||||
return "specifyType";
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
doSingleTest(getTestName(false) + ".kt");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
org.jetbrains.jet.plugin.intentions.AddBracesIntention
|
||||
+1
@@ -0,0 +1 @@
|
||||
org.jetbrains.jet.plugin.intentions.TestableReplaceBinaryInfixIntention
|
||||
+1
@@ -0,0 +1 @@
|
||||
org.jetbrains.jet.plugin.intentions.TestableReplaceContainsIntention
|
||||
+1
@@ -0,0 +1 @@
|
||||
org.jetbrains.jet.plugin.intentions.TestableReplaceGetIntention
|
||||
+1
@@ -0,0 +1 @@
|
||||
org.jetbrains.jet.plugin.intentions.TestableReplaceInvokeIntention
|
||||
+1
@@ -0,0 +1 @@
|
||||
org.jetbrains.jet.plugin.intentions.TestableReplaceUnaryPrefixIntention
|
||||
@@ -0,0 +1 @@
|
||||
org.jetbrains.jet.plugin.intentions.branchedTransformations.intentions.DoubleBangToIfThenIntention
|
||||
@@ -0,0 +1 @@
|
||||
org.jetbrains.jet.plugin.intentions.branchedTransformations.intentions.ElvisToIfThenIntention
|
||||
+1
@@ -0,0 +1 @@
|
||||
org.jetbrains.jet.plugin.intentions.branchedTransformations.intentions.FoldIfToAssignmentIntention
|
||||
@@ -0,0 +1 @@
|
||||
org.jetbrains.jet.plugin.intentions.branchedTransformations.intentions.FoldIfToReturnIntention
|
||||
+1
@@ -0,0 +1 @@
|
||||
org.jetbrains.jet.plugin.intentions.branchedTransformations.intentions.FoldIfToReturnAsymmetricallyIntention
|
||||
+1
@@ -0,0 +1 @@
|
||||
org.jetbrains.jet.plugin.intentions.branchedTransformations.intentions.FoldWhenToAssignmentIntention
|
||||
@@ -0,0 +1 @@
|
||||
org.jetbrains.jet.plugin.intentions.branchedTransformations.intentions.FoldWhenToReturnIntention
|
||||
@@ -0,0 +1 @@
|
||||
org.jetbrains.jet.plugin.intentions.branchedTransformations.intentions.IfThenToDoubleBangIntention
|
||||
@@ -0,0 +1 @@
|
||||
org.jetbrains.jet.plugin.intentions.branchedTransformations.intentions.IfThenToElvisIntention
|
||||
@@ -0,0 +1 @@
|
||||
org.jetbrains.jet.plugin.intentions.branchedTransformations.intentions.IfThenToSafeAccessIntention
|
||||
@@ -0,0 +1 @@
|
||||
org.jetbrains.jet.plugin.intentions.branchedTransformations.intentions.IfToWhenIntention
|
||||
@@ -0,0 +1 @@
|
||||
org.jetbrains.jet.plugin.intentions.branchedTransformations.intentions.WhenToIfIntention
|
||||
@@ -0,0 +1 @@
|
||||
org.jetbrains.jet.plugin.intentions.branchedTransformations.intentions.SafeAccessToIfThenIntention
|
||||
+1
@@ -0,0 +1 @@
|
||||
org.jetbrains.jet.plugin.intentions.branchedTransformations.intentions.UnfoldAssignmentToIfIntention
|
||||
+1
@@ -0,0 +1 @@
|
||||
org.jetbrains.jet.plugin.intentions.branchedTransformations.intentions.UnfoldAssignmentToWhenIntention
|
||||
+1
@@ -0,0 +1 @@
|
||||
org.jetbrains.jet.plugin.intentions.branchedTransformations.intentions.UnfoldPropertyToIfIntention
|
||||
+1
@@ -0,0 +1 @@
|
||||
org.jetbrains.jet.plugin.intentions.branchedTransformations.intentions.UnfoldPropertyToWhenIntention
|
||||
@@ -0,0 +1 @@
|
||||
org.jetbrains.jet.plugin.intentions.branchedTransformations.intentions.UnfoldReturnToIfIntention
|
||||
+1
@@ -0,0 +1 @@
|
||||
org.jetbrains.jet.plugin.intentions.branchedTransformations.intentions.UnfoldReturnToWhenIntention
|
||||
+1
@@ -0,0 +1 @@
|
||||
org.jetbrains.jet.plugin.intentions.branchedTransformations.intentions.EliminateWhenSubjectIntention
|
||||
@@ -0,0 +1 @@
|
||||
org.jetbrains.jet.plugin.intentions.branchedTransformations.intentions.FlattenWhenIntention
|
||||
+1
@@ -0,0 +1 @@
|
||||
org.jetbrains.jet.plugin.intentions.branchedTransformations.intentions.IntroduceWhenSubjectIntention
|
||||
@@ -0,0 +1 @@
|
||||
org.jetbrains.jet.plugin.intentions.branchedTransformations.intentions.MergeWhenIntention
|
||||
@@ -0,0 +1 @@
|
||||
org.jetbrains.jet.plugin.intentions.ConvertAssertToIfWithThrowIntention
|
||||
@@ -0,0 +1 @@
|
||||
org.jetbrains.jet.plugin.intentions.ConvertIfWithThrowToAssertIntention
|
||||
@@ -0,0 +1 @@
|
||||
org.jetbrains.jet.plugin.intentions.ConvertNegatedBooleanSequenceIntention
|
||||
+1
@@ -0,0 +1 @@
|
||||
org.jetbrains.jet.plugin.intentions.ConvertNegatedExpressionWithDemorgansLawIntention
|
||||
@@ -0,0 +1 @@
|
||||
org.jetbrains.jet.plugin.intentions.ConvertToBlockBodyAction
|
||||
-2
@@ -1,2 +0,0 @@
|
||||
// "Convert to block body" "true"
|
||||
fun <caret>foo(): String = "abc"
|
||||
+1
@@ -0,0 +1 @@
|
||||
fun <caret>foo(): String = "abc"
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// "Convert to block body" "true"
|
||||
fun foo(): String {
|
||||
return "abc"
|
||||
}
|
||||
-1
@@ -1,3 +1,2 @@
|
||||
// "Convert to block body" "true"
|
||||
// ERROR: Unresolved reference: bar
|
||||
fun <caret>foo(): String = bar()
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// "Convert to block body" "true"
|
||||
// ERROR: Unresolved reference: bar
|
||||
fun <caret>foo(): String {
|
||||
return bar()
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// "Convert to block body" "true"
|
||||
// ERROR: Unresolved reference: XXX
|
||||
// ERROR: Unresolved reference: bar
|
||||
fun <caret>foo(): XXX = bar()
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// "Convert to block body" "true"
|
||||
// ERROR: Unresolved reference: XXX
|
||||
// ERROR: Unresolved reference: bar
|
||||
fun <caret>foo(): XXX {
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// "Convert to block body" "true"
|
||||
fun <caret>foo(): Unit = bar()
|
||||
|
||||
fun bar() { }
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// "Convert to block body" "true"
|
||||
fun foo(): Unit {
|
||||
bar()
|
||||
}
|
||||
-1
@@ -1,3 +1,2 @@
|
||||
// "Convert to block body" "true"
|
||||
// ERROR: Unresolved reference: bar
|
||||
fun <caret>foo(): Unit = bar()
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// "Convert to block body" "true"
|
||||
// ERROR: Unresolved reference: bar
|
||||
fun <caret>foo(): Unit {
|
||||
bar()
|
||||
+2
-1
@@ -1,2 +1,3 @@
|
||||
// "Convert to block body" "true"
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun <caret>foo(): String = throw UnsupportedOperationException()
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
// "Convert to block body" "true"
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun <caret>foo(): String {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
-1
@@ -1,3 +1,2 @@
|
||||
// "Convert to block body" "true"
|
||||
val foo: String
|
||||
<caret>get() = "abc"
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// "Convert to block body" "true"
|
||||
val foo: String
|
||||
get() {
|
||||
return "abc"
|
||||
+2
-1
@@ -1,3 +1,4 @@
|
||||
// "Convert to block body" "true"
|
||||
// WITH_RUNTIME
|
||||
|
||||
val foo: String
|
||||
<caret>get() = throw UnsupportedOperationException()
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
// "Convert to block body" "true"
|
||||
// WITH_RUNTIME
|
||||
|
||||
val foo: String
|
||||
get() {
|
||||
throw UnsupportedOperationException()
|
||||
+2
-1
@@ -1,2 +1,3 @@
|
||||
// "Convert to block body" "true"
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun <caret>foo() = java.io.File("x").toURI()
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
// "Convert to block body" "true"
|
||||
// WITH_RUNTIME
|
||||
|
||||
import java.net.URI
|
||||
|
||||
fun foo(): URI {
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
// "Convert to block body" "false"
|
||||
// IS_APPLICABLE: false
|
||||
// ERROR: Unresolved reference: bar
|
||||
fun <caret>foo() = bar()
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// "Convert to block body" "true"
|
||||
fun <caret>foo() = bar()
|
||||
|
||||
fun bar() { }
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// "Convert to block body" "true"
|
||||
fun foo() {
|
||||
bar()
|
||||
}
|
||||
+2
-1
@@ -1,2 +1,3 @@
|
||||
// "Convert to block body" "true"
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun <caret>foo(): Nothing = throw UnsupportedOperationException()
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
// "Convert to block body" "true"
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(): Nothing {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// "Convert to block body" "true"
|
||||
var foo: String
|
||||
get() = "abc"
|
||||
<caret>set(value) = doSet(value)
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// "Convert to block body" "true"
|
||||
var foo: String
|
||||
get() = "abc"
|
||||
set(value) {
|
||||
+1
@@ -0,0 +1 @@
|
||||
org.jetbrains.jet.plugin.intentions.ConvertToConcatenatedStringIntention
|
||||
@@ -0,0 +1 @@
|
||||
org.jetbrains.jet.plugin.intentions.ConvertToExpressionBodyAction
|
||||
-2
@@ -1,2 +0,0 @@
|
||||
// "Convert to expression body" "true"
|
||||
fun foo(): String = "abc"
|
||||
-4
@@ -1,4 +0,0 @@
|
||||
// "Convert to expression body" "true"
|
||||
fun foo() = bar()
|
||||
|
||||
fun bar() { }
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
// "Convert to expression body" "true"
|
||||
val foo: String
|
||||
get() = "abc"
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// "Convert to expression body" "true"
|
||||
trait I {
|
||||
fun foo(): String
|
||||
}
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// "Convert to expression body" "true"
|
||||
trait I {
|
||||
fun foo(): String
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// IS_APPLICABLE: false
|
||||
|
||||
var a = 1
|
||||
var b = 2
|
||||
|
||||
fun foo() {
|
||||
<caret>a = b
|
||||
}
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
// "class org.jetbrains.jet.plugin.intentions.ConvertToExpressionBodyAction" "false"
|
||||
|
||||
var a = 1
|
||||
var b = 2
|
||||
|
||||
fun foo() {
|
||||
<caret>a = b
|
||||
}
|
||||
-5
@@ -1,5 +0,0 @@
|
||||
// "class org.jetbrains.jet.plugin.intentions.ConvertToExpressionBodyAction" "false"
|
||||
|
||||
fun foo() {
|
||||
<caret>val v = 1
|
||||
}
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
// "class org.jetbrains.jet.plugin.intentions.ConvertToExpressionBodyAction" "false"
|
||||
|
||||
fun foo() = <caret>"abc"
|
||||
-7
@@ -1,7 +0,0 @@
|
||||
// "class org.jetbrains.jet.plugin.intentions.ConvertToExpressionBodyAction" "false"
|
||||
|
||||
fun foo() {
|
||||
<caret>bar()
|
||||
}
|
||||
|
||||
fun bar(): String = "abc"
|
||||
-6
@@ -1,6 +0,0 @@
|
||||
// "class org.jetbrains.jet.plugin.intentions.ConvertToExpressionBodyAction" "false"
|
||||
|
||||
fun foo(): String {
|
||||
val v = 1
|
||||
<caret>return "abc"
|
||||
}
|
||||
-5
@@ -1,5 +0,0 @@
|
||||
// "class org.jetbrains.jet.plugin.intentions.ConvertToExpressionBodyAction" "false"
|
||||
|
||||
fun foo() {
|
||||
<caret>return
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
// "class org.jetbrains.jet.plugin.intentions.ConvertToExpressionBodyAction" "false"
|
||||
|
||||
fun foo(p: Boolean): String {
|
||||
<caret>while(true) { }
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// IS_APPLICABLE: false
|
||||
|
||||
fun foo() {
|
||||
<caret>val v = 1
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "class org.jetbrains.jet.plugin.intentions.ConvertToExpressionBodyAction" "false"
|
||||
// IS_APPLICABLE: false
|
||||
|
||||
fun foo(p: Boolean): String {
|
||||
return bar() ?: return "a"
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "class org.jetbrains.jet.plugin.intentions.ConvertToExpressionBodyAction" "false"
|
||||
// IS_APPLICABLE: false
|
||||
|
||||
fun foo(p: Boolean): String {
|
||||
if (p) {
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
// "Convert to expression body" "true"
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo() {
|
||||
<caret>throw UnsupportedOperationException()
|
||||
}
|
||||
+2
-1
@@ -1,2 +1,3 @@
|
||||
// "Convert to expression body" "true"
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(): Unit = throw UnsupportedOperationException()
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
// IS_APPLICABLE: false
|
||||
|
||||
fun foo() = <caret>"abc"
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
// "Convert to expression body" "true"
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(): Nothing {
|
||||
<caret>throw UnsupportedOperationException()
|
||||
}
|
||||
+2
-1
@@ -1,2 +1,3 @@
|
||||
// "Convert to expression body" "true"
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(): Nothing = throw UnsupportedOperationException()
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// "Convert to expression body" "true"
|
||||
fun <caret>foo(): String {
|
||||
return "abc"
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
fun foo(): String = "abc"
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// "Convert to expression body" "true"
|
||||
fun foo() {
|
||||
<caret>bar()
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
fun foo() = bar()
|
||||
|
||||
fun bar() { }
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// IS_APPLICABLE: false
|
||||
|
||||
fun foo() {
|
||||
<caret>bar()
|
||||
}
|
||||
|
||||
fun bar(): String = "abc"
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
// "Convert to expression body" "true"
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(): Unit {
|
||||
<caret>throw UnsupportedOperationException()
|
||||
}
|
||||
+2
-1
@@ -1,2 +1,3 @@
|
||||
// "Convert to expression body" "true"
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(): Unit = throw UnsupportedOperationException()
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "class org.jetbrains.jet.plugin.intentions.ConvertToExpressionBodyAction" "false"
|
||||
// IS_APPLICABLE: false
|
||||
|
||||
fun foo(handler: () -> Unit) { }
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// "Convert to expression body" "true"
|
||||
val foo: String
|
||||
<caret>get() {
|
||||
return "abc"
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
val foo: String
|
||||
get() = "abc"
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user