Merge branch master into pr/269
This commit is contained in:
@@ -79,6 +79,11 @@ public class JetBasicJSCompletionTestGenerated extends AbstractJetJSCompletionTe
|
||||
doTest("idea/testData/completion/basic/common/CallLocalLambda.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("classObjectElementsInClass.kt")
|
||||
public void testClassObjectElementsInClass() throws Exception {
|
||||
doTest("idea/testData/completion/basic/common/classObjectElementsInClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ClassRedeclaration1.kt")
|
||||
public void testClassRedeclaration1() throws Exception {
|
||||
doTest("idea/testData/completion/basic/common/ClassRedeclaration1.kt");
|
||||
|
||||
@@ -79,6 +79,11 @@ public class JetBasicJavaCompletionTestGenerated extends AbstractJavaCompletionT
|
||||
doTest("idea/testData/completion/basic/common/CallLocalLambda.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("classObjectElementsInClass.kt")
|
||||
public void testClassObjectElementsInClass() throws Exception {
|
||||
doTest("idea/testData/completion/basic/common/classObjectElementsInClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ClassRedeclaration1.kt")
|
||||
public void testClassRedeclaration1() throws Exception {
|
||||
doTest("idea/testData/completion/basic/common/ClassRedeclaration1.kt");
|
||||
|
||||
@@ -22,35 +22,19 @@ import com.intellij.codeInsight.lookup.LookupElementPresentation;
|
||||
import com.intellij.codeInsight.lookup.LookupEvent;
|
||||
import com.intellij.codeInsight.lookup.LookupManager;
|
||||
import com.intellij.codeInsight.lookup.impl.LookupImpl;
|
||||
import com.intellij.ide.startup.impl.StartupManagerImpl;
|
||||
import com.intellij.openapi.command.WriteCommandAction;
|
||||
import com.intellij.openapi.startup.StartupManager;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettings;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
|
||||
import com.intellij.testFramework.LightProjectDescriptor;
|
||||
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
|
||||
import junit.framework.Assert;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.plugin.JetLightProjectDescriptor;
|
||||
import org.jetbrains.jet.plugin.JetLightCodeInsightFixtureTestCase;
|
||||
import org.jetbrains.jet.plugin.PluginTestCaseBase;
|
||||
import org.jetbrains.jet.plugin.formatter.JetCodeStyleSettings;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class CompletionHandlerTest extends LightCodeInsightFixtureTestCase {
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
((StartupManagerImpl) StartupManager.getInstance(getProject())).runPostStartupActivities();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected LightProjectDescriptor getProjectDescriptor() {
|
||||
return JetLightProjectDescriptor.INSTANCE;
|
||||
}
|
||||
|
||||
public class CompletionHandlerTest extends JetLightCodeInsightFixtureTestCase {
|
||||
public void testClassCompletionImport() {
|
||||
doTest(CompletionType.BASIC, 2, "SortedSet", null, '\n');
|
||||
}
|
||||
@@ -59,6 +43,10 @@ public class CompletionHandlerTest extends LightCodeInsightFixtureTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testDoNotInsertDefaultJsImports() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testDoNotInsertImportIfResolvedIntoJavaConstructor() {
|
||||
doTest();
|
||||
}
|
||||
@@ -88,9 +76,9 @@ public class CompletionHandlerTest extends LightCodeInsightFixtureTestCase {
|
||||
}
|
||||
|
||||
public void testSingleBrackets() {
|
||||
myFixture.configureByFile(getBeforeFileName());
|
||||
myFixture.configureByFile(fileName());
|
||||
myFixture.type('(');
|
||||
myFixture.checkResultByFile(getAfterFileName());
|
||||
myFixture.checkResultByFile(afterFileName());
|
||||
}
|
||||
|
||||
public void testExistingSingleBrackets() {
|
||||
@@ -106,9 +94,9 @@ public class CompletionHandlerTest extends LightCodeInsightFixtureTestCase {
|
||||
}
|
||||
|
||||
public void testInsertFunctionWithBothParentheses() {
|
||||
myFixture.configureByFile(getBeforeFileName());
|
||||
myFixture.configureByFile(fileName());
|
||||
myFixture.type("test()");
|
||||
myFixture.checkResultByFile(getAfterFileName());
|
||||
myFixture.checkResultByFile(afterFileName());
|
||||
}
|
||||
|
||||
public void testInsertImportOnTab() {
|
||||
@@ -144,7 +132,7 @@ public class CompletionHandlerTest extends LightCodeInsightFixtureTestCase {
|
||||
}
|
||||
|
||||
public void doTest(CompletionType type, int time, @Nullable String lookupString, @Nullable String tailText, char completionChar) {
|
||||
myFixture.configureByFile(getBeforeFileName());
|
||||
myFixture.configureByFile(fileName());
|
||||
|
||||
if (lookupString != null || tailText != null) {
|
||||
myFixture.complete(type, time);
|
||||
@@ -158,7 +146,7 @@ public class CompletionHandlerTest extends LightCodeInsightFixtureTestCase {
|
||||
forceCompleteFirst(type, time);
|
||||
}
|
||||
|
||||
myFixture.checkResultByFile(getAfterFileName());
|
||||
myFixture.checkResultByFile(afterFileName());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -203,11 +191,7 @@ public class CompletionHandlerTest extends LightCodeInsightFixtureTestCase {
|
||||
return foundElement;
|
||||
}
|
||||
|
||||
protected String getBeforeFileName() {
|
||||
return getTestName(false) + ".kt";
|
||||
}
|
||||
|
||||
protected String getAfterFileName() {
|
||||
protected String afterFileName() {
|
||||
return getTestName(false) + ".kt.after";
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* 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.editor;
|
||||
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.testFramework.EditorTestUtil;
|
||||
import com.intellij.testFramework.LightCodeInsightTestCase;
|
||||
import org.jetbrains.jet.plugin.PluginTestCaseBase;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class JetCommenterTest extends LightCodeInsightTestCase {
|
||||
private static final String BASE_PATH =
|
||||
new File(PluginTestCaseBase.getTestDataPathBase(), "/editor/commenter/").getAbsolutePath();
|
||||
|
||||
public void testGenerateDocComment() throws Exception {
|
||||
doNewLineTypingTest();
|
||||
}
|
||||
|
||||
public void testNewLineInComment() throws Exception {
|
||||
doNewLineTypingTest();
|
||||
}
|
||||
|
||||
private void doNewLineTypingTest() throws Exception {
|
||||
configure();
|
||||
EditorTestUtil.performTypingAction(getEditor(), '\n');
|
||||
check();
|
||||
}
|
||||
|
||||
private void configure() throws Exception {
|
||||
configureFromFileText("a.kt", loadFile(getTestName(true) + ".kt"));
|
||||
}
|
||||
|
||||
private void check() throws Exception {
|
||||
checkResultByText(loadFile(getTestName(true) + "_after.kt"));
|
||||
}
|
||||
|
||||
protected static String loadFile(String name) throws Exception {
|
||||
String text = FileUtil.loadFile(new File(BASE_PATH, name));
|
||||
text = StringUtil.convertLineSeparators(text);
|
||||
return text;
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,24 @@ public class TypedHandlerTest extends LightCodeInsightTestCase {
|
||||
checkResultByText("val x = \"${}\"");
|
||||
}
|
||||
|
||||
public void testTypeStringTemplateStartWithCloseBraceAfter() throws Exception {
|
||||
configureFromFileText("a.kt", "fun foo() { \"$<caret>\" }");
|
||||
EditorTestUtil.performTypingAction(getEditor(), '{');
|
||||
checkResultByText("fun foo() { \"${}\" }");
|
||||
}
|
||||
|
||||
public void testTypeStringTemplateStartBeforeString() throws Exception {
|
||||
configureFromFileText("a.kt", "fun foo() { \"$<caret>something\" }");
|
||||
EditorTestUtil.performTypingAction(getEditor(), '{');
|
||||
checkResultByText("fun foo() { \"${}something\" }");
|
||||
}
|
||||
|
||||
public void testKT3575() throws Exception {
|
||||
configureFromFileText("a.kt", "val x = \"$<caret>]\"");
|
||||
EditorTestUtil.performTypingAction(getEditor(), '{');
|
||||
checkResultByText("val x = \"${}]\"");
|
||||
}
|
||||
|
||||
public void testTypeLtInFunDeclaration() throws Exception {
|
||||
doLtGtTest("fun <caret>");
|
||||
}
|
||||
|
||||
@@ -72,6 +72,10 @@ public class JetFormatterTest extends AbstractJetFormatterTest {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testKDoc() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testMultilineFunctionLiteral() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.intellij.ide.startup.impl.StartupManagerImpl;
|
||||
import com.intellij.openapi.startup.StartupManager;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.testFramework.LightProjectDescriptor;
|
||||
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.InTextDirectivesUtils;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public abstract class JetLightCodeInsightFixtureTestCase extends LightCodeInsightFixtureTestCase {
|
||||
LightProjectDescriptor projectDescriptor = null;
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
String fileText = FileUtil.loadFile(new File(getTestDataPath(), fileName()));
|
||||
if (InTextDirectivesUtils.isDirectiveDefined(fileText, "RUNTIME")) {
|
||||
projectDescriptor = JetWithJdkAndRuntimeLightProjectDescriptor.INSTANCE;
|
||||
}
|
||||
else if (InTextDirectivesUtils.isDirectiveDefined(fileText, "JS")) {
|
||||
projectDescriptor = JetStdJSProjectDescriptor.INSTANCE;
|
||||
}
|
||||
else {
|
||||
projectDescriptor = JetLightProjectDescriptor.INSTANCE;
|
||||
}
|
||||
|
||||
super.setUp();
|
||||
|
||||
((StartupManagerImpl) StartupManager.getInstance(getProject())).runPostStartupActivities();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
super.tearDown();
|
||||
projectDescriptor = null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected LightProjectDescriptor getProjectDescriptor() {
|
||||
return projectDescriptor;
|
||||
}
|
||||
|
||||
protected String fileName() {
|
||||
return getTestName(false) + ".kt";
|
||||
}
|
||||
}
|
||||
+11
-4
@@ -22,13 +22,12 @@ import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.PsiDocumentManager;
|
||||
import com.intellij.testFramework.ExpectedHighlightingData;
|
||||
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
|
||||
import org.jetbrains.jet.plugin.JetLightCodeInsightFixtureTestCase;
|
||||
import org.jetbrains.jet.plugin.PluginTestCaseBase;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class OverrideImplementLineMarkerTest extends LightCodeInsightFixtureTestCase {
|
||||
|
||||
public class OverrideImplementLineMarkerTest extends JetLightCodeInsightFixtureTestCase {
|
||||
@Override
|
||||
protected String getBasePath() {
|
||||
return PluginTestCaseBase.TEST_DATA_PROJECT_RELATIVE + "/codeInsight/lineMarker";
|
||||
@@ -42,9 +41,17 @@ public class OverrideImplementLineMarkerTest extends LightCodeInsightFixtureTest
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testOverrideFunction() throws Throwable {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testPropertyOverride() throws Throwable {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
try {
|
||||
myFixture.configureByFile(getTestName(false) + ".kt");
|
||||
myFixture.configureByFile(fileName());
|
||||
Project project = myFixture.getProject();
|
||||
Document document = myFixture.getEditor().getDocument();
|
||||
|
||||
|
||||
@@ -224,7 +224,7 @@ public class OverrideImplementTest extends LightCodeInsightFixtureTestCase {
|
||||
else {
|
||||
CallableMemberDescriptor candidateToOverride = null;
|
||||
for (CallableMemberDescriptor callable : descriptors) {
|
||||
if (callable.getName().getName().equals(memberToOverride)) {
|
||||
if (callable.getName().asString().equals(memberToOverride)) {
|
||||
if (candidateToOverride != null) {
|
||||
throw new IllegalStateException("more then one descriptor with name " + memberToOverride);
|
||||
}
|
||||
|
||||
+61
-4
@@ -21,16 +21,73 @@ import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.testFramework.LightCodeInsightTestCase;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.InTextDirectivesUtils;
|
||||
import org.jetbrains.jet.plugin.codeInsight.codeTransformations.branchedTransformations.intentions.*;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public abstract class AbstractCodeTransformationTest extends LightCodeInsightTestCase {
|
||||
public void doTestIfStatementWithAssignmentsToExpression(@NotNull String path) throws Exception {
|
||||
doTest(path, new IfStatementWithAssignmentsToExpressionIntention());
|
||||
public void doTestFoldIfToAssignment(@NotNull String path) throws Exception {
|
||||
doTest(path, new FoldBranchedExpressionIntention.FoldIfToAssignmentIntention());
|
||||
}
|
||||
|
||||
public void doTestAssignmentWithIfExpressionToStatement(@NotNull String path) throws Exception {
|
||||
doTest(path, new AssignmentWithIfExpressionToStatementIntention());
|
||||
public void doTestFoldIfToReturn(@NotNull String path) throws Exception {
|
||||
doTest(path, new FoldBranchedExpressionIntention.FoldIfToReturnIntention());
|
||||
}
|
||||
|
||||
public void doTestFoldIfToReturnAsymmetrically(@NotNull String path) throws Exception {
|
||||
doTest(path, new FoldBranchedExpressionIntention.FoldIfToReturnAsymmetricallyIntention());
|
||||
}
|
||||
|
||||
public void doTestFoldWhenToAssignment(@NotNull String path) throws Exception {
|
||||
doTest(path, new FoldBranchedExpressionIntention.FoldWhenToAssignmentIntention());
|
||||
}
|
||||
|
||||
public void doTestFoldWhenToReturn(@NotNull String path) throws Exception {
|
||||
doTest(path, new FoldBranchedExpressionIntention.FoldWhenToReturnIntention());
|
||||
}
|
||||
|
||||
public void doTestUnfoldAssignmentToIf(@NotNull String path) throws Exception {
|
||||
doTest(path, new UnfoldBranchedExpressionIntention.UnfoldAssignmentToIfIntention());
|
||||
}
|
||||
|
||||
public void doTestUnfoldAssignmentToWhen(@NotNull String path) throws Exception {
|
||||
doTest(path, new UnfoldBranchedExpressionIntention.UnfoldAssignmentToWhenIntention());
|
||||
}
|
||||
|
||||
public void doTestUnfoldPropertyToIf(@NotNull String path) throws Exception {
|
||||
doTest(path, new UnfoldBranchedExpressionIntention.UnfoldPropertyToIfIntention());
|
||||
}
|
||||
|
||||
public void doTestUnfoldPropertyToWhen(@NotNull String path) throws Exception {
|
||||
doTest(path, new UnfoldBranchedExpressionIntention.UnfoldPropertyToWhenIntention());
|
||||
}
|
||||
|
||||
public void doTestUnfoldReturnToIf(@NotNull String path) throws Exception {
|
||||
doTest(path, new UnfoldBranchedExpressionIntention.UnfoldReturnToIfIntention());
|
||||
}
|
||||
|
||||
public void doTestUnfoldReturnToWhen(@NotNull String path) throws Exception {
|
||||
doTest(path, new UnfoldBranchedExpressionIntention.UnfoldReturnToWhenIntention());
|
||||
}
|
||||
|
||||
public void doTestIfToWhen(@NotNull String path) throws Exception {
|
||||
doTest(path, new IfToWhenIntention());
|
||||
}
|
||||
|
||||
public void doTestWhenToIf(@NotNull String path) throws Exception {
|
||||
doTest(path, new WhenToIfIntention());
|
||||
}
|
||||
|
||||
public void doTestFlattenWhen(@NotNull String path) throws Exception {
|
||||
doTest(path, new FlattenWhenIntention());
|
||||
}
|
||||
|
||||
public void doTestIntroduceWhenSubject(@NotNull String path) throws Exception {
|
||||
doTest(path, new IntroduceWhenSubjectIntention());
|
||||
}
|
||||
|
||||
public void doTestEliminateWhenSubject(@NotNull String path) throws Exception {
|
||||
doTest(path, new EliminateWhenSubjectIntention());
|
||||
}
|
||||
|
||||
public void doTestRemoveUnnecessaryParentheses(@NotNull String path) throws Exception {
|
||||
|
||||
+563
-71
@@ -30,142 +30,634 @@ import org.jetbrains.jet.plugin.codeInsight.codeTransformations.AbstractCodeTran
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.jet.generators.tests.GenerateTests}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@InnerTestClasses({CodeTransformationsTestGenerated.IfStatementWithAssignmentsToExpression.class, CodeTransformationsTestGenerated.AssignmentWithIfExpressionToStatement.class, CodeTransformationsTestGenerated.RemoveUnnecessaryParentheses.class})
|
||||
@InnerTestClasses({CodeTransformationsTestGenerated.IfToAssignment.class, CodeTransformationsTestGenerated.IfToReturn.class, CodeTransformationsTestGenerated.IfToReturnAsymmetrically.class, CodeTransformationsTestGenerated.WhenToAssignment.class, CodeTransformationsTestGenerated.WhenToReturn.class, CodeTransformationsTestGenerated.AssignmentToIf.class, CodeTransformationsTestGenerated.AssignmentToWhen.class, CodeTransformationsTestGenerated.PropertyToIf.class, CodeTransformationsTestGenerated.PropertyToWhen.class, CodeTransformationsTestGenerated.ReturnToIf.class, CodeTransformationsTestGenerated.ReturnToWhen.class, CodeTransformationsTestGenerated.IfToWhen.class, CodeTransformationsTestGenerated.WhenToIf.class, CodeTransformationsTestGenerated.Flatten.class, CodeTransformationsTestGenerated.IntroduceSubject.class, CodeTransformationsTestGenerated.EliminateSubject.class})
|
||||
public class CodeTransformationsTestGenerated extends AbstractCodeTransformationTest {
|
||||
@TestMetadata("idea/testData/codeInsight/codeTransformations/ifStatementWithAssignmentsToExpression")
|
||||
public static class IfStatementWithAssignmentsToExpression extends AbstractCodeTransformationTest {
|
||||
public void testAllFilesPresentInIfStatementWithAssignmentsToExpression() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/codeInsight/codeTransformations/ifStatementWithAssignmentsToExpression"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
@TestMetadata("idea/testData/codeInsight/codeTransformations/branched/folding/ifToAssignment")
|
||||
public static class IfToAssignment extends AbstractCodeTransformationTest {
|
||||
public void testAllFilesPresentInIfToAssignment() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/codeInsight/codeTransformations/branched/folding/ifToAssignment"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("innerIfTransformed.kt")
|
||||
public void testInnerIfTransformed() throws Exception {
|
||||
doTestIfStatementWithAssignmentsToExpression("idea/testData/codeInsight/codeTransformations/ifStatementWithAssignmentsToExpression/innerIfTransformed.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nestedIfs.kt")
|
||||
public void testNestedIfs() throws Exception {
|
||||
doTestIfStatementWithAssignmentsToExpression("idea/testData/codeInsight/codeTransformations/ifStatementWithAssignmentsToExpression/nestedIfs.kt");
|
||||
doTestFoldIfToAssignment("idea/testData/codeInsight/codeTransformations/branched/folding/ifToAssignment/innerIfTransformed.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simpleIf.kt")
|
||||
public void testSimpleIf() throws Exception {
|
||||
doTestIfStatementWithAssignmentsToExpression("idea/testData/codeInsight/codeTransformations/ifStatementWithAssignmentsToExpression/simpleIf.kt");
|
||||
doTestFoldIfToAssignment("idea/testData/codeInsight/codeTransformations/branched/folding/ifToAssignment/simpleIf.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simpleIfWithAugmentedAssignment.kt")
|
||||
public void testSimpleIfWithAugmentedAssignment() throws Exception {
|
||||
doTestFoldIfToAssignment("idea/testData/codeInsight/codeTransformations/branched/folding/ifToAssignment/simpleIfWithAugmentedAssignment.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simpleIfWithBlocks.kt")
|
||||
public void testSimpleIfWithBlocks() throws Exception {
|
||||
doTestFoldIfToAssignment("idea/testData/codeInsight/codeTransformations/branched/folding/ifToAssignment/simpleIfWithBlocks.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simpleIfWithShadowedVar.kt")
|
||||
public void testSimpleIfWithShadowedVar() throws Exception {
|
||||
doTestFoldIfToAssignment("idea/testData/codeInsight/codeTransformations/branched/folding/ifToAssignment/simpleIfWithShadowedVar.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simpleIfWithUnmatchedAssignmentOps.kt")
|
||||
public void testSimpleIfWithUnmatchedAssignmentOps() throws Exception {
|
||||
doTestFoldIfToAssignment("idea/testData/codeInsight/codeTransformations/branched/folding/ifToAssignment/simpleIfWithUnmatchedAssignmentOps.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simpleIfWithUnmatchedAssignments.kt")
|
||||
public void testSimpleIfWithUnmatchedAssignments() throws Exception {
|
||||
doTestFoldIfToAssignment("idea/testData/codeInsight/codeTransformations/branched/folding/ifToAssignment/simpleIfWithUnmatchedAssignments.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simpleIfWithoutElse.kt")
|
||||
public void testSimpleIfWithoutElse() throws Exception {
|
||||
doTestIfStatementWithAssignmentsToExpression("idea/testData/codeInsight/codeTransformations/ifStatementWithAssignmentsToExpression/simpleIfWithoutElse.kt");
|
||||
doTestFoldIfToAssignment("idea/testData/codeInsight/codeTransformations/branched/folding/ifToAssignment/simpleIfWithoutElse.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simpleIfWithoutTerminatingAssignment.kt")
|
||||
public void testSimpleIfWithoutTerminatingAssignment() throws Exception {
|
||||
doTestIfStatementWithAssignmentsToExpression("idea/testData/codeInsight/codeTransformations/ifStatementWithAssignmentsToExpression/simpleIfWithoutTerminatingAssignment.kt");
|
||||
doTestFoldIfToAssignment("idea/testData/codeInsight/codeTransformations/branched/folding/ifToAssignment/simpleIfWithoutTerminatingAssignment.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/codeInsight/codeTransformations/assignmentWithIfExpressionToStatement")
|
||||
public static class AssignmentWithIfExpressionToStatement extends AbstractCodeTransformationTest {
|
||||
public void testAllFilesPresentInAssignmentWithIfExpressionToStatement() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/codeInsight/codeTransformations/assignmentWithIfExpressionToStatement"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
@TestMetadata("idea/testData/codeInsight/codeTransformations/branched/folding/ifToReturn")
|
||||
public static class IfToReturn extends AbstractCodeTransformationTest {
|
||||
public void testAllFilesPresentInIfToReturn() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/codeInsight/codeTransformations/branched/folding/ifToReturn"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("innerIfTransformed.kt")
|
||||
public void testInnerIfTransformed() throws Exception {
|
||||
doTestAssignmentWithIfExpressionToStatement("idea/testData/codeInsight/codeTransformations/assignmentWithIfExpressionToStatement/innerIfTransformed.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nestedIfs.kt")
|
||||
public void testNestedIfs() throws Exception {
|
||||
doTestAssignmentWithIfExpressionToStatement("idea/testData/codeInsight/codeTransformations/assignmentWithIfExpressionToStatement/nestedIfs.kt");
|
||||
doTestFoldIfToReturn("idea/testData/codeInsight/codeTransformations/branched/folding/ifToReturn/innerIfTransformed.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simpleIf.kt")
|
||||
public void testSimpleIf() throws Exception {
|
||||
doTestAssignmentWithIfExpressionToStatement("idea/testData/codeInsight/codeTransformations/assignmentWithIfExpressionToStatement/simpleIf.kt");
|
||||
doTestFoldIfToReturn("idea/testData/codeInsight/codeTransformations/branched/folding/ifToReturn/simpleIf.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simpleIfWithoutAssignment.kt")
|
||||
public void testSimpleIfWithoutAssignment() throws Exception {
|
||||
doTestAssignmentWithIfExpressionToStatement("idea/testData/codeInsight/codeTransformations/assignmentWithIfExpressionToStatement/simpleIfWithoutAssignment.kt");
|
||||
@TestMetadata("simpleIfWithBlocks.kt")
|
||||
public void testSimpleIfWithBlocks() throws Exception {
|
||||
doTestFoldIfToReturn("idea/testData/codeInsight/codeTransformations/branched/folding/ifToReturn/simpleIfWithBlocks.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/codeInsight/codeTransformations/removeUnnecessaryParentheses")
|
||||
public static class RemoveUnnecessaryParentheses extends AbstractCodeTransformationTest {
|
||||
public void testAllFilesPresentInRemoveUnnecessaryParentheses() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/codeInsight/codeTransformations/removeUnnecessaryParentheses"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
@TestMetadata("idea/testData/codeInsight/codeTransformations/branched/folding/ifToReturnAsymmetrically")
|
||||
public static class IfToReturnAsymmetrically extends AbstractCodeTransformationTest {
|
||||
public void testAllFilesPresentInIfToReturnAsymmetrically() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/codeInsight/codeTransformations/branched/folding/ifToReturnAsymmetrically"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("necessaryParentheses1.kt")
|
||||
public void testNecessaryParentheses1() throws Exception {
|
||||
doTestRemoveUnnecessaryParentheses("idea/testData/codeInsight/codeTransformations/removeUnnecessaryParentheses/necessaryParentheses1.kt");
|
||||
@TestMetadata("simpleIf.kt")
|
||||
public void testSimpleIf() throws Exception {
|
||||
doTestFoldIfToReturnAsymmetrically("idea/testData/codeInsight/codeTransformations/branched/folding/ifToReturnAsymmetrically/simpleIf.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("necessaryParentheses2.kt")
|
||||
public void testNecessaryParentheses2() throws Exception {
|
||||
doTestRemoveUnnecessaryParentheses("idea/testData/codeInsight/codeTransformations/removeUnnecessaryParentheses/necessaryParentheses2.kt");
|
||||
@TestMetadata("simpleIfWithBlocks.kt")
|
||||
public void testSimpleIfWithBlocks() throws Exception {
|
||||
doTestFoldIfToReturnAsymmetrically("idea/testData/codeInsight/codeTransformations/branched/folding/ifToReturnAsymmetrically/simpleIfWithBlocks.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("necessaryParentheses3.kt")
|
||||
public void testNecessaryParentheses3() throws Exception {
|
||||
doTestRemoveUnnecessaryParentheses("idea/testData/codeInsight/codeTransformations/removeUnnecessaryParentheses/necessaryParentheses3.kt");
|
||||
@TestMetadata("simpleIfWithComments.kt")
|
||||
public void testSimpleIfWithComments() throws Exception {
|
||||
doTestFoldIfToReturnAsymmetrically("idea/testData/codeInsight/codeTransformations/branched/folding/ifToReturnAsymmetrically/simpleIfWithComments.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("necessaryParentheses4.kt")
|
||||
public void testNecessaryParentheses4() throws Exception {
|
||||
doTestRemoveUnnecessaryParentheses("idea/testData/codeInsight/codeTransformations/removeUnnecessaryParentheses/necessaryParentheses4.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/codeInsight/codeTransformations/branched/folding/whenToAssignment")
|
||||
public static class WhenToAssignment extends AbstractCodeTransformationTest {
|
||||
public void testAllFilesPresentInWhenToAssignment() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/codeInsight/codeTransformations/branched/folding/whenToAssignment"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("necessaryParentheses5.kt")
|
||||
public void testNecessaryParentheses5() throws Exception {
|
||||
doTestRemoveUnnecessaryParentheses("idea/testData/codeInsight/codeTransformations/removeUnnecessaryParentheses/necessaryParentheses5.kt");
|
||||
@TestMetadata("innerWhenTransformed.kt")
|
||||
public void testInnerWhenTransformed() throws Exception {
|
||||
doTestFoldWhenToAssignment("idea/testData/codeInsight/codeTransformations/branched/folding/whenToAssignment/innerWhenTransformed.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("unnecessaryParentheses1.kt")
|
||||
public void testUnnecessaryParentheses1() throws Exception {
|
||||
doTestRemoveUnnecessaryParentheses("idea/testData/codeInsight/codeTransformations/removeUnnecessaryParentheses/unnecessaryParentheses1.kt");
|
||||
@TestMetadata("simpleWhen.kt")
|
||||
public void testSimpleWhen() throws Exception {
|
||||
doTestFoldWhenToAssignment("idea/testData/codeInsight/codeTransformations/branched/folding/whenToAssignment/simpleWhen.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("unnecessaryParentheses2.kt")
|
||||
public void testUnnecessaryParentheses2() throws Exception {
|
||||
doTestRemoveUnnecessaryParentheses("idea/testData/codeInsight/codeTransformations/removeUnnecessaryParentheses/unnecessaryParentheses2.kt");
|
||||
@TestMetadata("simpleWhenWithBlocks.kt")
|
||||
public void testSimpleWhenWithBlocks() throws Exception {
|
||||
doTestFoldWhenToAssignment("idea/testData/codeInsight/codeTransformations/branched/folding/whenToAssignment/simpleWhenWithBlocks.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("unnecessaryParentheses3.kt")
|
||||
public void testUnnecessaryParentheses3() throws Exception {
|
||||
doTestRemoveUnnecessaryParentheses("idea/testData/codeInsight/codeTransformations/removeUnnecessaryParentheses/unnecessaryParentheses3.kt");
|
||||
@TestMetadata("simpleWhenWithShadowedVar.kt")
|
||||
public void testSimpleWhenWithShadowedVar() throws Exception {
|
||||
doTestFoldWhenToAssignment("idea/testData/codeInsight/codeTransformations/branched/folding/whenToAssignment/simpleWhenWithShadowedVar.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("unnecessaryParentheses4.kt")
|
||||
public void testUnnecessaryParentheses4() throws Exception {
|
||||
doTestRemoveUnnecessaryParentheses("idea/testData/codeInsight/codeTransformations/removeUnnecessaryParentheses/unnecessaryParentheses4.kt");
|
||||
@TestMetadata("simpleWhenWithUnmatchedAssignments.kt")
|
||||
public void testSimpleWhenWithUnmatchedAssignments() throws Exception {
|
||||
doTestFoldWhenToAssignment("idea/testData/codeInsight/codeTransformations/branched/folding/whenToAssignment/simpleWhenWithUnmatchedAssignments.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("unnecessaryParentheses5.kt")
|
||||
public void testUnnecessaryParentheses5() throws Exception {
|
||||
doTestRemoveUnnecessaryParentheses("idea/testData/codeInsight/codeTransformations/removeUnnecessaryParentheses/unnecessaryParentheses5.kt");
|
||||
@TestMetadata("simpleWhenWithoutTerminatingAssignment.kt")
|
||||
public void testSimpleWhenWithoutTerminatingAssignment() throws Exception {
|
||||
doTestFoldWhenToAssignment("idea/testData/codeInsight/codeTransformations/branched/folding/whenToAssignment/simpleWhenWithoutTerminatingAssignment.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("unnecessaryParentheses6.kt")
|
||||
public void testUnnecessaryParentheses6() throws Exception {
|
||||
doTestRemoveUnnecessaryParentheses("idea/testData/codeInsight/codeTransformations/removeUnnecessaryParentheses/unnecessaryParentheses6.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/codeInsight/codeTransformations/branched/folding/whenToReturn")
|
||||
public static class WhenToReturn extends AbstractCodeTransformationTest {
|
||||
public void testAllFilesPresentInWhenToReturn() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/codeInsight/codeTransformations/branched/folding/whenToReturn"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("unnecessaryParentheses7.kt")
|
||||
public void testUnnecessaryParentheses7() throws Exception {
|
||||
doTestRemoveUnnecessaryParentheses("idea/testData/codeInsight/codeTransformations/removeUnnecessaryParentheses/unnecessaryParentheses7.kt");
|
||||
@TestMetadata("innerWhenTransformed.kt")
|
||||
public void testInnerWhenTransformed() throws Exception {
|
||||
doTestFoldWhenToReturn("idea/testData/codeInsight/codeTransformations/branched/folding/whenToReturn/innerWhenTransformed.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simpleWhen.kt")
|
||||
public void testSimpleWhen() throws Exception {
|
||||
doTestFoldWhenToReturn("idea/testData/codeInsight/codeTransformations/branched/folding/whenToReturn/simpleWhen.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simpleWhenWithBlocks.kt")
|
||||
public void testSimpleWhenWithBlocks() throws Exception {
|
||||
doTestFoldWhenToReturn("idea/testData/codeInsight/codeTransformations/branched/folding/whenToReturn/simpleWhenWithBlocks.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/codeInsight/codeTransformations/branched/unfolding/assignmentToIf")
|
||||
public static class AssignmentToIf extends AbstractCodeTransformationTest {
|
||||
public void testAllFilesPresentInAssignmentToIf() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/codeInsight/codeTransformations/branched/unfolding/assignmentToIf"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("innerIfTransformed.kt")
|
||||
public void testInnerIfTransformed() throws Exception {
|
||||
doTestUnfoldAssignmentToIf("idea/testData/codeInsight/codeTransformations/branched/unfolding/assignmentToIf/innerIfTransformed.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nestedIfs.kt")
|
||||
public void testNestedIfs() throws Exception {
|
||||
doTestUnfoldAssignmentToIf("idea/testData/codeInsight/codeTransformations/branched/unfolding/assignmentToIf/nestedIfs.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simpleIf.kt")
|
||||
public void testSimpleIf() throws Exception {
|
||||
doTestUnfoldAssignmentToIf("idea/testData/codeInsight/codeTransformations/branched/unfolding/assignmentToIf/simpleIf.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simpleIfWithAugmentedAssignment.kt")
|
||||
public void testSimpleIfWithAugmentedAssignment() throws Exception {
|
||||
doTestUnfoldAssignmentToIf("idea/testData/codeInsight/codeTransformations/branched/unfolding/assignmentToIf/simpleIfWithAugmentedAssignment.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simpleIfWithBlocks.kt")
|
||||
public void testSimpleIfWithBlocks() throws Exception {
|
||||
doTestUnfoldAssignmentToIf("idea/testData/codeInsight/codeTransformations/branched/unfolding/assignmentToIf/simpleIfWithBlocks.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simpleIfWithComplexAssignmentLHS.kt")
|
||||
public void testSimpleIfWithComplexAssignmentLHS() throws Exception {
|
||||
doTestUnfoldAssignmentToIf("idea/testData/codeInsight/codeTransformations/branched/unfolding/assignmentToIf/simpleIfWithComplexAssignmentLHS.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simpleIfWithoutAssignment.kt")
|
||||
public void testSimpleIfWithoutAssignment() throws Exception {
|
||||
doTestUnfoldAssignmentToIf("idea/testData/codeInsight/codeTransformations/branched/unfolding/assignmentToIf/simpleIfWithoutAssignment.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/codeInsight/codeTransformations/branched/unfolding/assignmentToWhen")
|
||||
public static class AssignmentToWhen extends AbstractCodeTransformationTest {
|
||||
public void testAllFilesPresentInAssignmentToWhen() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/codeInsight/codeTransformations/branched/unfolding/assignmentToWhen"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("innerWhenTransformed.kt")
|
||||
public void testInnerWhenTransformed() throws Exception {
|
||||
doTestUnfoldAssignmentToWhen("idea/testData/codeInsight/codeTransformations/branched/unfolding/assignmentToWhen/innerWhenTransformed.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simpleWhen.kt")
|
||||
public void testSimpleWhen() throws Exception {
|
||||
doTestUnfoldAssignmentToWhen("idea/testData/codeInsight/codeTransformations/branched/unfolding/assignmentToWhen/simpleWhen.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simpleWhenWithBlocks.kt")
|
||||
public void testSimpleWhenWithBlocks() throws Exception {
|
||||
doTestUnfoldAssignmentToWhen("idea/testData/codeInsight/codeTransformations/branched/unfolding/assignmentToWhen/simpleWhenWithBlocks.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simpleWhenWithComplexAssignmentLHS.kt")
|
||||
public void testSimpleWhenWithComplexAssignmentLHS() throws Exception {
|
||||
doTestUnfoldAssignmentToWhen("idea/testData/codeInsight/codeTransformations/branched/unfolding/assignmentToWhen/simpleWhenWithComplexAssignmentLHS.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/codeInsight/codeTransformations/branched/unfolding/propertyToIf")
|
||||
public static class PropertyToIf extends AbstractCodeTransformationTest {
|
||||
public void testAllFilesPresentInPropertyToIf() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/codeInsight/codeTransformations/branched/unfolding/propertyToIf"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("nestedIfs.kt")
|
||||
public void testNestedIfs() throws Exception {
|
||||
doTestUnfoldPropertyToIf("idea/testData/codeInsight/codeTransformations/branched/unfolding/propertyToIf/nestedIfs.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nestedIfs2.kt")
|
||||
public void testNestedIfs2() throws Exception {
|
||||
doTestUnfoldPropertyToIf("idea/testData/codeInsight/codeTransformations/branched/unfolding/propertyToIf/nestedIfs2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nonLocalProperty.kt")
|
||||
public void testNonLocalProperty() throws Exception {
|
||||
doTestUnfoldPropertyToIf("idea/testData/codeInsight/codeTransformations/branched/unfolding/propertyToIf/nonLocalProperty.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nonLocalProperty2.kt")
|
||||
public void testNonLocalProperty2() throws Exception {
|
||||
doTestUnfoldPropertyToIf("idea/testData/codeInsight/codeTransformations/branched/unfolding/propertyToIf/nonLocalProperty2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simpleIf.kt")
|
||||
public void testSimpleIf() throws Exception {
|
||||
doTestUnfoldPropertyToIf("idea/testData/codeInsight/codeTransformations/branched/unfolding/propertyToIf/simpleIf.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simpleIf2.kt")
|
||||
public void testSimpleIf2() throws Exception {
|
||||
doTestUnfoldPropertyToIf("idea/testData/codeInsight/codeTransformations/branched/unfolding/propertyToIf/simpleIf2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simpleIfWithBlocks.kt")
|
||||
public void testSimpleIfWithBlocks() throws Exception {
|
||||
doTestUnfoldPropertyToIf("idea/testData/codeInsight/codeTransformations/branched/unfolding/propertyToIf/simpleIfWithBlocks.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simpleIfWithBlocks2.kt")
|
||||
public void testSimpleIfWithBlocks2() throws Exception {
|
||||
doTestUnfoldPropertyToIf("idea/testData/codeInsight/codeTransformations/branched/unfolding/propertyToIf/simpleIfWithBlocks2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simpleIfWithType.kt")
|
||||
public void testSimpleIfWithType() throws Exception {
|
||||
doTestUnfoldPropertyToIf("idea/testData/codeInsight/codeTransformations/branched/unfolding/propertyToIf/simpleIfWithType.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/codeInsight/codeTransformations/branched/unfolding/propertyToWhen")
|
||||
public static class PropertyToWhen extends AbstractCodeTransformationTest {
|
||||
public void testAllFilesPresentInPropertyToWhen() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/codeInsight/codeTransformations/branched/unfolding/propertyToWhen"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("nonLocalProperty.kt")
|
||||
public void testNonLocalProperty() throws Exception {
|
||||
doTestUnfoldPropertyToWhen("idea/testData/codeInsight/codeTransformations/branched/unfolding/propertyToWhen/nonLocalProperty.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nonLocalProperty2.kt")
|
||||
public void testNonLocalProperty2() throws Exception {
|
||||
doTestUnfoldPropertyToWhen("idea/testData/codeInsight/codeTransformations/branched/unfolding/propertyToWhen/nonLocalProperty2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simpleWhen.kt")
|
||||
public void testSimpleWhen() throws Exception {
|
||||
doTestUnfoldPropertyToWhen("idea/testData/codeInsight/codeTransformations/branched/unfolding/propertyToWhen/simpleWhen.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simpleWhen2.kt")
|
||||
public void testSimpleWhen2() throws Exception {
|
||||
doTestUnfoldPropertyToWhen("idea/testData/codeInsight/codeTransformations/branched/unfolding/propertyToWhen/simpleWhen2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simpleWhenWithBlocks.kt")
|
||||
public void testSimpleWhenWithBlocks() throws Exception {
|
||||
doTestUnfoldPropertyToWhen("idea/testData/codeInsight/codeTransformations/branched/unfolding/propertyToWhen/simpleWhenWithBlocks.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simpleWhenWithBlocks2.kt")
|
||||
public void testSimpleWhenWithBlocks2() throws Exception {
|
||||
doTestUnfoldPropertyToWhen("idea/testData/codeInsight/codeTransformations/branched/unfolding/propertyToWhen/simpleWhenWithBlocks2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simpleWhenWithType.kt")
|
||||
public void testSimpleWhenWithType() throws Exception {
|
||||
doTestUnfoldPropertyToWhen("idea/testData/codeInsight/codeTransformations/branched/unfolding/propertyToWhen/simpleWhenWithType.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/codeInsight/codeTransformations/branched/unfolding/returnToIf")
|
||||
public static class ReturnToIf extends AbstractCodeTransformationTest {
|
||||
public void testAllFilesPresentInReturnToIf() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/codeInsight/codeTransformations/branched/unfolding/returnToIf"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("innerIfTransformed.kt")
|
||||
public void testInnerIfTransformed() throws Exception {
|
||||
doTestUnfoldReturnToIf("idea/testData/codeInsight/codeTransformations/branched/unfolding/returnToIf/innerIfTransformed.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simpleIf.kt")
|
||||
public void testSimpleIf() throws Exception {
|
||||
doTestUnfoldReturnToIf("idea/testData/codeInsight/codeTransformations/branched/unfolding/returnToIf/simpleIf.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simpleIfWithBlocks.kt")
|
||||
public void testSimpleIfWithBlocks() throws Exception {
|
||||
doTestUnfoldReturnToIf("idea/testData/codeInsight/codeTransformations/branched/unfolding/returnToIf/simpleIfWithBlocks.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/codeInsight/codeTransformations/branched/unfolding/returnToWhen")
|
||||
public static class ReturnToWhen extends AbstractCodeTransformationTest {
|
||||
public void testAllFilesPresentInReturnToWhen() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/codeInsight/codeTransformations/branched/unfolding/returnToWhen"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("innerWhenTransformed.kt")
|
||||
public void testInnerWhenTransformed() throws Exception {
|
||||
doTestUnfoldReturnToWhen("idea/testData/codeInsight/codeTransformations/branched/unfolding/returnToWhen/innerWhenTransformed.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simpleWhen.kt")
|
||||
public void testSimpleWhen() throws Exception {
|
||||
doTestUnfoldReturnToWhen("idea/testData/codeInsight/codeTransformations/branched/unfolding/returnToWhen/simpleWhen.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simpleWhenWithBlocks.kt")
|
||||
public void testSimpleWhenWithBlocks() throws Exception {
|
||||
doTestUnfoldReturnToWhen("idea/testData/codeInsight/codeTransformations/branched/unfolding/returnToWhen/simpleWhenWithBlocks.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/codeInsight/codeTransformations/branched/ifWhen/ifToWhen")
|
||||
public static class IfToWhen extends AbstractCodeTransformationTest {
|
||||
public void testAllFilesPresentInIfToWhen() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/codeInsight/codeTransformations/branched/ifWhen/ifToWhen"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("ifWithEqualityTests.kt")
|
||||
public void testIfWithEqualityTests() throws Exception {
|
||||
doTestIfToWhen("idea/testData/codeInsight/codeTransformations/branched/ifWhen/ifToWhen/ifWithEqualityTests.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ifWithIs.kt")
|
||||
public void testIfWithIs() throws Exception {
|
||||
doTestIfToWhen("idea/testData/codeInsight/codeTransformations/branched/ifWhen/ifToWhen/ifWithIs.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ifWithMultiConditions.kt")
|
||||
public void testIfWithMultiConditions() throws Exception {
|
||||
doTestIfToWhen("idea/testData/codeInsight/codeTransformations/branched/ifWhen/ifToWhen/ifWithMultiConditions.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ifWithNegativeIs.kt")
|
||||
public void testIfWithNegativeIs() throws Exception {
|
||||
doTestIfToWhen("idea/testData/codeInsight/codeTransformations/branched/ifWhen/ifToWhen/ifWithNegativeIs.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ifWithNegativeRangeTests.kt")
|
||||
public void testIfWithNegativeRangeTests() throws Exception {
|
||||
doTestIfToWhen("idea/testData/codeInsight/codeTransformations/branched/ifWhen/ifToWhen/ifWithNegativeRangeTests.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ifWithRangeTests.kt")
|
||||
public void testIfWithRangeTests() throws Exception {
|
||||
doTestIfToWhen("idea/testData/codeInsight/codeTransformations/branched/ifWhen/ifToWhen/ifWithRangeTests.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ifWithRangeTestsAndMultiConditions.kt")
|
||||
public void testIfWithRangeTestsAndMultiConditions() throws Exception {
|
||||
doTestIfToWhen("idea/testData/codeInsight/codeTransformations/branched/ifWhen/ifToWhen/ifWithRangeTestsAndMultiConditions.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ifWithRangeTestsAndUnparenthesizedMultiConditions.kt")
|
||||
public void testIfWithRangeTestsAndUnparenthesizedMultiConditions() throws Exception {
|
||||
doTestIfToWhen("idea/testData/codeInsight/codeTransformations/branched/ifWhen/ifToWhen/ifWithRangeTestsAndUnparenthesizedMultiConditions.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("whenWithMultipleConditionTypes.kt")
|
||||
public void testWhenWithMultipleConditionTypes() throws Exception {
|
||||
doTestIfToWhen("idea/testData/codeInsight/codeTransformations/branched/ifWhen/ifToWhen/whenWithMultipleConditionTypes.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/codeInsight/codeTransformations/branched/ifWhen/whenToIf")
|
||||
public static class WhenToIf extends AbstractCodeTransformationTest {
|
||||
public void testAllFilesPresentInWhenToIf() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/codeInsight/codeTransformations/branched/ifWhen/whenToIf"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("whenWithEqualityTests.kt")
|
||||
public void testWhenWithEqualityTests() throws Exception {
|
||||
doTestWhenToIf("idea/testData/codeInsight/codeTransformations/branched/ifWhen/whenToIf/whenWithEqualityTests.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("whenWithMultiConditions.kt")
|
||||
public void testWhenWithMultiConditions() throws Exception {
|
||||
doTestWhenToIf("idea/testData/codeInsight/codeTransformations/branched/ifWhen/whenToIf/whenWithMultiConditions.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("whenWithMultipleConditionTypes.kt")
|
||||
public void testWhenWithMultipleConditionTypes() throws Exception {
|
||||
doTestWhenToIf("idea/testData/codeInsight/codeTransformations/branched/ifWhen/whenToIf/whenWithMultipleConditionTypes.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("whenWithNegativePatterns.kt")
|
||||
public void testWhenWithNegativePatterns() throws Exception {
|
||||
doTestWhenToIf("idea/testData/codeInsight/codeTransformations/branched/ifWhen/whenToIf/whenWithNegativePatterns.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("whenWithNegativeRangeTests.kt")
|
||||
public void testWhenWithNegativeRangeTests() throws Exception {
|
||||
doTestWhenToIf("idea/testData/codeInsight/codeTransformations/branched/ifWhen/whenToIf/whenWithNegativeRangeTests.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("whenWithPatterns.kt")
|
||||
public void testWhenWithPatterns() throws Exception {
|
||||
doTestWhenToIf("idea/testData/codeInsight/codeTransformations/branched/ifWhen/whenToIf/whenWithPatterns.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("whenWithRangeTests.kt")
|
||||
public void testWhenWithRangeTests() throws Exception {
|
||||
doTestWhenToIf("idea/testData/codeInsight/codeTransformations/branched/ifWhen/whenToIf/whenWithRangeTests.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("whenWithRangeTestsAndMultiConditions.kt")
|
||||
public void testWhenWithRangeTestsAndMultiConditions() throws Exception {
|
||||
doTestWhenToIf("idea/testData/codeInsight/codeTransformations/branched/ifWhen/whenToIf/whenWithRangeTestsAndMultiConditions.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("whenWithoutSubject.kt")
|
||||
public void testWhenWithoutSubject() throws Exception {
|
||||
doTestWhenToIf("idea/testData/codeInsight/codeTransformations/branched/ifWhen/whenToIf/whenWithoutSubject.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/codeInsight/codeTransformations/branched/when/flatten")
|
||||
public static class Flatten extends AbstractCodeTransformationTest {
|
||||
public void testAllFilesPresentInFlatten() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/codeInsight/codeTransformations/branched/when/flatten"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("flattenWithSubject.kt")
|
||||
public void testFlattenWithSubject() throws Exception {
|
||||
doTestFlattenWhen("idea/testData/codeInsight/codeTransformations/branched/when/flatten/flattenWithSubject.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("flattenWithUnmatchedSubjects.kt")
|
||||
public void testFlattenWithUnmatchedSubjects() throws Exception {
|
||||
doTestFlattenWhen("idea/testData/codeInsight/codeTransformations/branched/when/flatten/flattenWithUnmatchedSubjects.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("flattenWithoutSubject.kt")
|
||||
public void testFlattenWithoutSubject() throws Exception {
|
||||
doTestFlattenWhen("idea/testData/codeInsight/codeTransformations/branched/when/flatten/flattenWithoutSubject.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/codeInsight/codeTransformations/branched/when/introduceSubject")
|
||||
public static class IntroduceSubject extends AbstractCodeTransformationTest {
|
||||
public void testAllFilesPresentInIntroduceSubject() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/codeInsight/codeTransformations/branched/when/introduceSubject"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("whenWithEqualityTests.kt")
|
||||
public void testWhenWithEqualityTests() throws Exception {
|
||||
doTestIntroduceWhenSubject("idea/testData/codeInsight/codeTransformations/branched/when/introduceSubject/whenWithEqualityTests.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("whenWithMultipleConditionTypes.kt")
|
||||
public void testWhenWithMultipleConditionTypes() throws Exception {
|
||||
doTestIntroduceWhenSubject("idea/testData/codeInsight/codeTransformations/branched/when/introduceSubject/whenWithMultipleConditionTypes.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("whenWithNegativePatterns.kt")
|
||||
public void testWhenWithNegativePatterns() throws Exception {
|
||||
doTestIntroduceWhenSubject("idea/testData/codeInsight/codeTransformations/branched/when/introduceSubject/whenWithNegativePatterns.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("whenWithNegativeRangeTests.kt")
|
||||
public void testWhenWithNegativeRangeTests() throws Exception {
|
||||
doTestIntroduceWhenSubject("idea/testData/codeInsight/codeTransformations/branched/when/introduceSubject/whenWithNegativeRangeTests.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("whenWithNondivisibleConditions.kt")
|
||||
public void testWhenWithNondivisibleConditions() throws Exception {
|
||||
doTestIntroduceWhenSubject("idea/testData/codeInsight/codeTransformations/branched/when/introduceSubject/whenWithNondivisibleConditions.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("whenWithPatterns.kt")
|
||||
public void testWhenWithPatterns() throws Exception {
|
||||
doTestIntroduceWhenSubject("idea/testData/codeInsight/codeTransformations/branched/when/introduceSubject/whenWithPatterns.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("whenWithRangeTests.kt")
|
||||
public void testWhenWithRangeTests() throws Exception {
|
||||
doTestIntroduceWhenSubject("idea/testData/codeInsight/codeTransformations/branched/when/introduceSubject/whenWithRangeTests.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("whenWithRangeTestsAndMultiConditions.kt")
|
||||
public void testWhenWithRangeTestsAndMultiConditions() throws Exception {
|
||||
doTestIntroduceWhenSubject("idea/testData/codeInsight/codeTransformations/branched/when/introduceSubject/whenWithRangeTestsAndMultiConditions.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("whenWithSubject.kt")
|
||||
public void testWhenWithSubject() throws Exception {
|
||||
doTestIntroduceWhenSubject("idea/testData/codeInsight/codeTransformations/branched/when/introduceSubject/whenWithSubject.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("whenWithUnmatchedCandidateSubjects.kt")
|
||||
public void testWhenWithUnmatchedCandidateSubjects() throws Exception {
|
||||
doTestIntroduceWhenSubject("idea/testData/codeInsight/codeTransformations/branched/when/introduceSubject/whenWithUnmatchedCandidateSubjects.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/codeInsight/codeTransformations/branched/when/eliminateSubject")
|
||||
public static class EliminateSubject extends AbstractCodeTransformationTest {
|
||||
public void testAllFilesPresentInEliminateSubject() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/codeInsight/codeTransformations/branched/when/eliminateSubject"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("whenWithEqualityTests.kt")
|
||||
public void testWhenWithEqualityTests() throws Exception {
|
||||
doTestEliminateWhenSubject("idea/testData/codeInsight/codeTransformations/branched/when/eliminateSubject/whenWithEqualityTests.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("whenWithMultipleConditionTypes.kt")
|
||||
public void testWhenWithMultipleConditionTypes() throws Exception {
|
||||
doTestEliminateWhenSubject("idea/testData/codeInsight/codeTransformations/branched/when/eliminateSubject/whenWithMultipleConditionTypes.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("whenWithNegativePatterns.kt")
|
||||
public void testWhenWithNegativePatterns() throws Exception {
|
||||
doTestEliminateWhenSubject("idea/testData/codeInsight/codeTransformations/branched/when/eliminateSubject/whenWithNegativePatterns.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("whenWithNegativeRangeTests.kt")
|
||||
public void testWhenWithNegativeRangeTests() throws Exception {
|
||||
doTestEliminateWhenSubject("idea/testData/codeInsight/codeTransformations/branched/when/eliminateSubject/whenWithNegativeRangeTests.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("whenWithPatterns.kt")
|
||||
public void testWhenWithPatterns() throws Exception {
|
||||
doTestEliminateWhenSubject("idea/testData/codeInsight/codeTransformations/branched/when/eliminateSubject/whenWithPatterns.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("whenWithRangeTests.kt")
|
||||
public void testWhenWithRangeTests() throws Exception {
|
||||
doTestEliminateWhenSubject("idea/testData/codeInsight/codeTransformations/branched/when/eliminateSubject/whenWithRangeTests.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("whenWithRangeTestsAndMultiConditions.kt")
|
||||
public void testWhenWithRangeTestsAndMultiConditions() throws Exception {
|
||||
doTestEliminateWhenSubject("idea/testData/codeInsight/codeTransformations/branched/when/eliminateSubject/whenWithRangeTestsAndMultiConditions.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("whenWithoutSubject.kt")
|
||||
public void testWhenWithoutSubject() throws Exception {
|
||||
doTestEliminateWhenSubject("idea/testData/codeInsight/codeTransformations/branched/when/eliminateSubject/whenWithoutSubject.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
TestSuite suite = new TestSuite("CodeTransformationsTestGenerated");
|
||||
suite.addTestSuite(IfStatementWithAssignmentsToExpression.class);
|
||||
suite.addTestSuite(AssignmentWithIfExpressionToStatement.class);
|
||||
suite.addTestSuite(RemoveUnnecessaryParentheses.class);
|
||||
suite.addTestSuite(IfToAssignment.class);
|
||||
suite.addTestSuite(IfToReturn.class);
|
||||
suite.addTestSuite(IfToReturnAsymmetrically.class);
|
||||
suite.addTestSuite(WhenToAssignment.class);
|
||||
suite.addTestSuite(WhenToReturn.class);
|
||||
suite.addTestSuite(AssignmentToIf.class);
|
||||
suite.addTestSuite(AssignmentToWhen.class);
|
||||
suite.addTestSuite(PropertyToIf.class);
|
||||
suite.addTestSuite(PropertyToWhen.class);
|
||||
suite.addTestSuite(ReturnToIf.class);
|
||||
suite.addTestSuite(ReturnToWhen.class);
|
||||
suite.addTestSuite(IfToWhen.class);
|
||||
suite.addTestSuite(WhenToIf.class);
|
||||
suite.addTestSuite(Flatten.class);
|
||||
suite.addTestSuite(IntroduceSubject.class);
|
||||
suite.addTestSuite(EliminateSubject.class);
|
||||
return suite;
|
||||
}
|
||||
}
|
||||
|
||||
+104
@@ -0,0 +1,104 @@
|
||||
/*
|
||||
* 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.codeInsight.moveUpDown;
|
||||
|
||||
import com.intellij.codeInsight.editorActions.moveUpDown.MoveStatementDownAction;
|
||||
import com.intellij.codeInsight.editorActions.moveUpDown.MoveStatementUpAction;
|
||||
import com.intellij.codeInsight.editorActions.moveUpDown.StatementUpDownMover;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.intellij.openapi.extensions.Extensions;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.psi.PsiDocumentManager;
|
||||
import com.intellij.testFramework.LightCodeInsightTestCase;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.InTextDirectivesUtils;
|
||||
import org.jetbrains.jet.plugin.codeInsight.upDownMover.JetDeclarationMover;
|
||||
import org.jetbrains.jet.plugin.codeInsight.upDownMover.JetExpressionMover;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public abstract class AbstractCodeMoverTest extends LightCodeInsightTestCase {
|
||||
public void doTestClassBodyDeclaration(@NotNull String path) throws Exception {
|
||||
doTest(path, JetDeclarationMover.class);
|
||||
}
|
||||
|
||||
public void doTestExpression(@NotNull String path) throws Exception {
|
||||
doTest(path, JetExpressionMover.class);
|
||||
}
|
||||
|
||||
private void doTest(@NotNull String path, @NotNull Class<? extends StatementUpDownMover> defaultMoverClass) throws Exception {
|
||||
configureByFile(path);
|
||||
|
||||
String fileText = FileUtil.loadFile(new File(path));
|
||||
String direction = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// MOVE: ");
|
||||
|
||||
boolean down = true;
|
||||
if ("up".equals(direction)) {
|
||||
down = false;
|
||||
}
|
||||
else if ("down".equals(direction)) {
|
||||
down = true;
|
||||
}
|
||||
else {
|
||||
fail("Direction is not specified");
|
||||
}
|
||||
|
||||
String isApplicableString = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// IS_APPLICABLE: ");
|
||||
boolean isApplicableExpected = isApplicableString == null || isApplicableString.equals("true");
|
||||
|
||||
StatementUpDownMover[] movers = Extensions.getExtensions(StatementUpDownMover.STATEMENT_UP_DOWN_MOVER_EP);
|
||||
StatementUpDownMover.MoveInfo info = new StatementUpDownMover.MoveInfo();
|
||||
StatementUpDownMover actualMover = null;
|
||||
for (StatementUpDownMover mover : movers) {
|
||||
if (mover.checkAvailable(getEditor(), getFile(), info, down)) {
|
||||
actualMover = mover;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
String moverClassName = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// MOVER_CLASS: ");
|
||||
if (moverClassName == null) {
|
||||
moverClassName = defaultMoverClass.getName();
|
||||
}
|
||||
|
||||
assertTrue("No mover found", actualMover != null);
|
||||
assertEquals("Unmatched movers", moverClassName, actualMover.getClass().getName());
|
||||
assertEquals("Invalid applicability", isApplicableExpected, info.toMove2 != null);
|
||||
|
||||
if (isApplicableExpected) {
|
||||
invokeAndCheck(path, down);
|
||||
}
|
||||
}
|
||||
|
||||
private void invokeAndCheck(@NotNull String path, final boolean down) {
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
EditorAction action = down ? new MoveStatementDownAction() : new MoveStatementUpAction();
|
||||
action.actionPerformed(getEditor(), getCurrentEditorDataContext());
|
||||
}
|
||||
});
|
||||
checkResultByFile(path + ".after");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTestDataPath() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
+864
@@ -0,0 +1,864 @@
|
||||
/*
|
||||
* 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.codeInsight.moveUpDown;
|
||||
|
||||
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.codeInsight.moveUpDown.AbstractCodeMoverTest;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.jet.generators.tests.GenerateTests}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@InnerTestClasses({CodeMoverTestGenerated.ClassBodyDeclarations.class, CodeMoverTestGenerated.ClosingBraces.class, CodeMoverTestGenerated.Expressions.class})
|
||||
public class CodeMoverTestGenerated extends AbstractCodeMoverTest {
|
||||
@TestMetadata("idea/testData/codeInsight/moveUpDown/classBodyDeclarations")
|
||||
@InnerTestClasses({ClassBodyDeclarations.Accessors.class, ClassBodyDeclarations.Class.class, ClassBodyDeclarations.ClassInitializer.class, ClassBodyDeclarations.Enums.class, ClassBodyDeclarations.Function.class, ClassBodyDeclarations.FunctionAnchors.class, ClassBodyDeclarations.Property.class, ClassBodyDeclarations.PropertyAnchors.class})
|
||||
public static class ClassBodyDeclarations extends AbstractCodeMoverTest {
|
||||
public void testAllFilesPresentInClassBodyDeclarations() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/codeInsight/moveUpDown/classBodyDeclarations"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/accessors")
|
||||
public static class Accessors extends AbstractCodeMoverTest {
|
||||
@TestMetadata("accessor1.kt")
|
||||
public void testAccessor1() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/accessors/accessor1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("accessor2.kt")
|
||||
public void testAccessor2() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/accessors/accessor2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("accessor3.kt")
|
||||
public void testAccessor3() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/accessors/accessor3.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("accessor4.kt")
|
||||
public void testAccessor4() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/accessors/accessor4.kt");
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInAccessors() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/accessors"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/class")
|
||||
public static class Class extends AbstractCodeMoverTest {
|
||||
public void testAllFilesPresentInClass() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/class"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("classAtBrace1.kt")
|
||||
public void testClassAtBrace1() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/class/classAtBrace1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("classAtBrace2.kt")
|
||||
public void testClassAtBrace2() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/class/classAtBrace2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("classAtBrace3.kt")
|
||||
public void testClassAtBrace3() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/class/classAtBrace3.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("classAtBrace4.kt")
|
||||
public void testClassAtBrace4() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/class/classAtBrace4.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("classAtBrace5.kt")
|
||||
public void testClassAtBrace5() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/class/classAtBrace5.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("classAtBrace6.kt")
|
||||
public void testClassAtBrace6() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/class/classAtBrace6.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("classAtClass1.kt")
|
||||
public void testClassAtClass1() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/class/classAtClass1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("classAtClass2.kt")
|
||||
public void testClassAtClass2() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/class/classAtClass2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("classAtClassInitializer1.kt")
|
||||
public void testClassAtClassInitializer1() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/class/classAtClassInitializer1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("classAtClassInitializer2.kt")
|
||||
public void testClassAtClassInitializer2() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/class/classAtClassInitializer2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("classAtEmptyLine1.kt")
|
||||
public void testClassAtEmptyLine1() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/class/classAtEmptyLine1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("classAtEmptyLine2.kt")
|
||||
public void testClassAtEmptyLine2() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/class/classAtEmptyLine2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("classAtFunction1.kt")
|
||||
public void testClassAtFunction1() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/class/classAtFunction1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("classAtFunction2.kt")
|
||||
public void testClassAtFunction2() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/class/classAtFunction2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("classAtProperty1.kt")
|
||||
public void testClassAtProperty1() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/class/classAtProperty1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("classAtProperty2.kt")
|
||||
public void testClassAtProperty2() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/class/classAtProperty2.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/classInitializer")
|
||||
public static class ClassInitializer extends AbstractCodeMoverTest {
|
||||
public void testAllFilesPresentInClassInitializer() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/classInitializer"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("classInitializerAtBrace1.kt")
|
||||
public void testClassInitializerAtBrace1() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/classInitializer/classInitializerAtBrace1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("classInitializerAtBrace2.kt")
|
||||
public void testClassInitializerAtBrace2() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/classInitializer/classInitializerAtBrace2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("classInitializerAtClass1.kt")
|
||||
public void testClassInitializerAtClass1() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/classInitializer/classInitializerAtClass1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("classInitializerAtClass2.kt")
|
||||
public void testClassInitializerAtClass2() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/classInitializer/classInitializerAtClass2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("classInitializerAtClassInitializer1.kt")
|
||||
public void testClassInitializerAtClassInitializer1() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/classInitializer/classInitializerAtClassInitializer1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("classInitializerAtClassInitializer2.kt")
|
||||
public void testClassInitializerAtClassInitializer2() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/classInitializer/classInitializerAtClassInitializer2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("classInitializerAtEmptyLine1.kt")
|
||||
public void testClassInitializerAtEmptyLine1() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/classInitializer/classInitializerAtEmptyLine1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("classInitializerAtEmptyLine2.kt")
|
||||
public void testClassInitializerAtEmptyLine2() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/classInitializer/classInitializerAtEmptyLine2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("classInitializerAtFunction1.kt")
|
||||
public void testClassInitializerAtFunction1() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/classInitializer/classInitializerAtFunction1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("classInitializerAtFunction2.kt")
|
||||
public void testClassInitializerAtFunction2() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/classInitializer/classInitializerAtFunction2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("classInitializerAtProperty1.kt")
|
||||
public void testClassInitializerAtProperty1() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/classInitializer/classInitializerAtProperty1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("classInitializerAtProperty2.kt")
|
||||
public void testClassInitializerAtProperty2() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/classInitializer/classInitializerAtProperty2.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/enums")
|
||||
public static class Enums extends AbstractCodeMoverTest {
|
||||
public void testAllFilesPresentInEnums() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/enums"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("enum1.kt")
|
||||
public void testEnum1() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/enums/enum1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("enum2.kt")
|
||||
public void testEnum2() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/enums/enum2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("enum3.kt")
|
||||
public void testEnum3() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/enums/enum3.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("enum4.kt")
|
||||
public void testEnum4() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/enums/enum4.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("enum5.kt")
|
||||
public void testEnum5() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/enums/enum5.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("enum6.kt")
|
||||
public void testEnum6() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/enums/enum6.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/function")
|
||||
public static class Function extends AbstractCodeMoverTest {
|
||||
public void testAllFilesPresentInFunction() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/function"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("functionAtBrace1.kt")
|
||||
public void testFunctionAtBrace1() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/function/functionAtBrace1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("functionAtBrace2.kt")
|
||||
public void testFunctionAtBrace2() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/function/functionAtBrace2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("functionAtBrace3.kt")
|
||||
public void testFunctionAtBrace3() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/function/functionAtBrace3.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("functionAtBrace4.kt")
|
||||
public void testFunctionAtBrace4() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/function/functionAtBrace4.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("functionAtBrace5.kt")
|
||||
public void testFunctionAtBrace5() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/function/functionAtBrace5.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("functionAtBrace6.kt")
|
||||
public void testFunctionAtBrace6() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/function/functionAtBrace6.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("functionAtClass1.kt")
|
||||
public void testFunctionAtClass1() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/function/functionAtClass1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("functionAtClass2.kt")
|
||||
public void testFunctionAtClass2() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/function/functionAtClass2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("functionAtClassInitializer1.kt")
|
||||
public void testFunctionAtClassInitializer1() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/function/functionAtClassInitializer1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("functionAtClassInitializer2.kt")
|
||||
public void testFunctionAtClassInitializer2() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/function/functionAtClassInitializer2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("functionAtEmptyLine1.kt")
|
||||
public void testFunctionAtEmptyLine1() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/function/functionAtEmptyLine1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("functionAtEmptyLine2.kt")
|
||||
public void testFunctionAtEmptyLine2() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/function/functionAtEmptyLine2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("functionAtFunction1.kt")
|
||||
public void testFunctionAtFunction1() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/function/functionAtFunction1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("functionAtFunction2.kt")
|
||||
public void testFunctionAtFunction2() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/function/functionAtFunction2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("functionAtProperty1.kt")
|
||||
public void testFunctionAtProperty1() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/function/functionAtProperty1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("functionAtProperty2.kt")
|
||||
public void testFunctionAtProperty2() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/function/functionAtProperty2.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/functionAnchors")
|
||||
public static class FunctionAnchors extends AbstractCodeMoverTest {
|
||||
public void testAllFilesPresentInFunctionAnchors() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/functionAnchors"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("keyword.kt")
|
||||
public void testKeyword() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/functionAnchors/keyword.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("name.kt")
|
||||
public void testName() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/functionAnchors/name.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("returnType.kt")
|
||||
public void testReturnType() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/functionAnchors/returnType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("typeParams1.kt")
|
||||
public void testTypeParams1() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/functionAnchors/typeParams1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("typeParams2.kt")
|
||||
public void testTypeParams2() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/functionAnchors/typeParams2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("typeParams3.kt")
|
||||
public void testTypeParams3() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/functionAnchors/typeParams3.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("valueArgs1.kt")
|
||||
public void testValueArgs1() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/functionAnchors/valueArgs1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("valueArgs2.kt")
|
||||
public void testValueArgs2() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/functionAnchors/valueArgs2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("valueArgs3.kt")
|
||||
public void testValueArgs3() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/functionAnchors/valueArgs3.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("valueArgs4.kt")
|
||||
public void testValueArgs4() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/functionAnchors/valueArgs4.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("valueArgs5.kt")
|
||||
public void testValueArgs5() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/functionAnchors/valueArgs5.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("valueArgs6.kt")
|
||||
public void testValueArgs6() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/functionAnchors/valueArgs6.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("valueParams1.kt")
|
||||
public void testValueParams1() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/functionAnchors/valueParams1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("valueParams2.kt")
|
||||
public void testValueParams2() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/functionAnchors/valueParams2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("valueParams3.kt")
|
||||
public void testValueParams3() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/functionAnchors/valueParams3.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("valueParams4.kt")
|
||||
public void testValueParams4() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/functionAnchors/valueParams4.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("valueParams5.kt")
|
||||
public void testValueParams5() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/functionAnchors/valueParams5.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("valueParams6.kt")
|
||||
public void testValueParams6() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/functionAnchors/valueParams6.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/property")
|
||||
public static class Property extends AbstractCodeMoverTest {
|
||||
public void testAllFilesPresentInProperty() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/property"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("propertyAtBrace1.kt")
|
||||
public void testPropertyAtBrace1() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/property/propertyAtBrace1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("propertyAtBrace2.kt")
|
||||
public void testPropertyAtBrace2() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/property/propertyAtBrace2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("propertyAtBrace3.kt")
|
||||
public void testPropertyAtBrace3() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/property/propertyAtBrace3.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("propertyAtBrace4.kt")
|
||||
public void testPropertyAtBrace4() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/property/propertyAtBrace4.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("propertyAtBrace5.kt")
|
||||
public void testPropertyAtBrace5() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/property/propertyAtBrace5.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("propertyAtBrace6.kt")
|
||||
public void testPropertyAtBrace6() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/property/propertyAtBrace6.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("propertyAtClass1.kt")
|
||||
public void testPropertyAtClass1() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/property/propertyAtClass1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("propertyAtClass2.kt")
|
||||
public void testPropertyAtClass2() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/property/propertyAtClass2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("propertyAtClassInitializer1.kt")
|
||||
public void testPropertyAtClassInitializer1() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/property/propertyAtClassInitializer1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("propertyAtClassInitializer2.kt")
|
||||
public void testPropertyAtClassInitializer2() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/property/propertyAtClassInitializer2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("propertyAtEmptyLine1.kt")
|
||||
public void testPropertyAtEmptyLine1() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/property/propertyAtEmptyLine1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("propertyAtEmptyLine2.kt")
|
||||
public void testPropertyAtEmptyLine2() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/property/propertyAtEmptyLine2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("propertyAtFunction1.kt")
|
||||
public void testPropertyAtFunction1() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/property/propertyAtFunction1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("propertyAtFunction2.kt")
|
||||
public void testPropertyAtFunction2() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/property/propertyAtFunction2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("propertyAtProperty1.kt")
|
||||
public void testPropertyAtProperty1() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/property/propertyAtProperty1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("propertyAtProperty2.kt")
|
||||
public void testPropertyAtProperty2() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/property/propertyAtProperty2.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/propertyAnchors")
|
||||
public static class PropertyAnchors extends AbstractCodeMoverTest {
|
||||
public void testAllFilesPresentInPropertyAnchors() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/propertyAnchors"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("keyword.kt")
|
||||
public void testKeyword() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/propertyAnchors/keyword.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("name.kt")
|
||||
public void testName() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/propertyAnchors/name.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("returnType.kt")
|
||||
public void testReturnType() throws Exception {
|
||||
doTestClassBodyDeclaration("idea/testData/codeInsight/moveUpDown/classBodyDeclarations/propertyAnchors/returnType.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static Test innerSuite() {
|
||||
TestSuite suite = new TestSuite("ClassBodyDeclarations");
|
||||
suite.addTestSuite(ClassBodyDeclarations.class);
|
||||
suite.addTestSuite(Accessors.class);
|
||||
suite.addTestSuite(Class.class);
|
||||
suite.addTestSuite(ClassInitializer.class);
|
||||
suite.addTestSuite(Enums.class);
|
||||
suite.addTestSuite(Function.class);
|
||||
suite.addTestSuite(FunctionAnchors.class);
|
||||
suite.addTestSuite(Property.class);
|
||||
suite.addTestSuite(PropertyAnchors.class);
|
||||
return suite;
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/codeInsight/moveUpDown/closingBraces")
|
||||
@InnerTestClasses({ClosingBraces.For.class, ClosingBraces.Function.class, ClosingBraces.If.class, ClosingBraces.Nested.class, ClosingBraces.When.class, ClosingBraces.While.class})
|
||||
public static class ClosingBraces extends AbstractCodeMoverTest {
|
||||
public void testAllFilesPresentInClosingBraces() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/codeInsight/moveUpDown/closingBraces"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/codeInsight/moveUpDown/closingBraces/for")
|
||||
public static class For extends AbstractCodeMoverTest {
|
||||
public void testAllFilesPresentInFor() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/codeInsight/moveUpDown/closingBraces/for"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("for1.kt")
|
||||
public void testFor1() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/closingBraces/for/for1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("for2.kt")
|
||||
public void testFor2() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/closingBraces/for/for2.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/codeInsight/moveUpDown/closingBraces/function")
|
||||
public static class Function extends AbstractCodeMoverTest {
|
||||
public void testAllFilesPresentInFunction() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/codeInsight/moveUpDown/closingBraces/function"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("function1.kt")
|
||||
public void testFunction1() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/closingBraces/function/function1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("function2.kt")
|
||||
public void testFunction2() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/closingBraces/function/function2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("function3.kt")
|
||||
public void testFunction3() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/closingBraces/function/function3.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("function4.kt")
|
||||
public void testFunction4() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/closingBraces/function/function4.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/codeInsight/moveUpDown/closingBraces/if")
|
||||
public static class If extends AbstractCodeMoverTest {
|
||||
public void testAllFilesPresentInIf() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/codeInsight/moveUpDown/closingBraces/if"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("if1.kt")
|
||||
public void testIf1() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/closingBraces/if/if1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("if2.kt")
|
||||
public void testIf2() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/closingBraces/if/if2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("if3.kt")
|
||||
public void testIf3() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/closingBraces/if/if3.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("if4.kt")
|
||||
public void testIf4() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/closingBraces/if/if4.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/codeInsight/moveUpDown/closingBraces/nested")
|
||||
public static class Nested extends AbstractCodeMoverTest {
|
||||
public void testAllFilesPresentInNested() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/codeInsight/moveUpDown/closingBraces/nested"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("nested1.kt")
|
||||
public void testNested1() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/closingBraces/nested/nested1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nested2.kt")
|
||||
public void testNested2() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/closingBraces/nested/nested2.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/codeInsight/moveUpDown/closingBraces/when")
|
||||
public static class When extends AbstractCodeMoverTest {
|
||||
public void testAllFilesPresentInWhen() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/codeInsight/moveUpDown/closingBraces/when"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("when1.kt")
|
||||
public void testWhen1() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/closingBraces/when/when1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("when2.kt")
|
||||
public void testWhen2() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/closingBraces/when/when2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("whenEntry1.kt")
|
||||
public void testWhenEntry1() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/closingBraces/when/whenEntry1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("whenEntry2.kt")
|
||||
public void testWhenEntry2() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/closingBraces/when/whenEntry2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("whenEntry3.kt")
|
||||
public void testWhenEntry3() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/closingBraces/when/whenEntry3.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("whenEntry4.kt")
|
||||
public void testWhenEntry4() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/closingBraces/when/whenEntry4.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/codeInsight/moveUpDown/closingBraces/while")
|
||||
public static class While extends AbstractCodeMoverTest {
|
||||
public void testAllFilesPresentInWhile() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/codeInsight/moveUpDown/closingBraces/while"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("while1.kt")
|
||||
public void testWhile1() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/closingBraces/while/while1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("while2.kt")
|
||||
public void testWhile2() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/closingBraces/while/while2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("while3.kt")
|
||||
public void testWhile3() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/closingBraces/while/while3.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("while4.kt")
|
||||
public void testWhile4() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/closingBraces/while/while4.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static Test innerSuite() {
|
||||
TestSuite suite = new TestSuite("ClosingBraces");
|
||||
suite.addTestSuite(ClosingBraces.class);
|
||||
suite.addTestSuite(For.class);
|
||||
suite.addTestSuite(Function.class);
|
||||
suite.addTestSuite(If.class);
|
||||
suite.addTestSuite(Nested.class);
|
||||
suite.addTestSuite(When.class);
|
||||
suite.addTestSuite(While.class);
|
||||
return suite;
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/codeInsight/moveUpDown/expressions")
|
||||
public static class Expressions extends AbstractCodeMoverTest {
|
||||
public void testAllFilesPresentInExpressions() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/codeInsight/moveUpDown/expressions"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("declaration1.kt")
|
||||
public void testDeclaration1() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/expressions/declaration1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("declaration2.kt")
|
||||
public void testDeclaration2() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/expressions/declaration2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("If1.kt")
|
||||
public void testIf1() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/expressions/If1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("if2.kt")
|
||||
public void testIf2() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/expressions/if2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("if3.kt")
|
||||
public void testIf3() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/expressions/if3.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("if4.kt")
|
||||
public void testIf4() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/expressions/if4.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("lambda1.kt")
|
||||
public void testLambda1() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/expressions/lambda1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("lambda2.kt")
|
||||
public void testLambda2() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/expressions/lambda2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("lambda3.kt")
|
||||
public void testLambda3() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/expressions/lambda3.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("when1.kt")
|
||||
public void testWhen1() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/expressions/when1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("when2.kt")
|
||||
public void testWhen2() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/expressions/when2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("whenEntry1.kt")
|
||||
public void testWhenEntry1() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/expressions/whenEntry1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("whenEntry2.kt")
|
||||
public void testWhenEntry2() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/expressions/whenEntry2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("whenEntry3.kt")
|
||||
public void testWhenEntry3() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/expressions/whenEntry3.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("whenEntry4.kt")
|
||||
public void testWhenEntry4() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/expressions/whenEntry4.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("whenEntry5.kt")
|
||||
public void testWhenEntry5() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/expressions/whenEntry5.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("whenEntry6.kt")
|
||||
public void testWhenEntry6() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/expressions/whenEntry6.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("while1.kt")
|
||||
public void testWhile1() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/expressions/while1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("while2.kt")
|
||||
public void testWhile2() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/expressions/while2.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
TestSuite suite = new TestSuite("CodeMoverTestGenerated");
|
||||
suite.addTest(ClassBodyDeclarations.innerSuite());
|
||||
suite.addTest(ClosingBraces.innerSuite());
|
||||
suite.addTestSuite(Expressions.class);
|
||||
return suite;
|
||||
}
|
||||
}
|
||||
@@ -16,28 +16,20 @@
|
||||
|
||||
package org.jetbrains.jet.plugin.importOptimizer;
|
||||
|
||||
import com.intellij.ide.startup.impl.StartupManagerImpl;
|
||||
import com.intellij.openapi.command.CommandProcessor;
|
||||
import com.intellij.openapi.command.UndoConfirmationPolicy;
|
||||
import com.intellij.openapi.projectRoots.JavaSdk;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.startup.StartupManager;
|
||||
import com.intellij.testFramework.LightCodeInsightTestCase;
|
||||
import org.apache.commons.lang.SystemUtils;
|
||||
import org.jetbrains.jet.plugin.JetLightCodeInsightFixtureTestCase;
|
||||
import org.jetbrains.jet.plugin.PluginTestCaseBase;
|
||||
import org.jetbrains.jet.plugin.editor.importOptimizer.JetImportOptimizer;
|
||||
import org.jetbrains.jet.testing.ConfigLibraryUtil;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class OptimizeImportsTest extends LightCodeInsightTestCase {
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
((StartupManagerImpl) StartupManager.getInstance(getProject())).runPostStartupActivities();
|
||||
public class OptimizeImportsTest extends JetLightCodeInsightFixtureTestCase {
|
||||
public void testAlreadyOptimized() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testAlreadyOptimized() throws Exception {
|
||||
public void testDefaultJsImports() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
@@ -54,7 +46,7 @@ public class OptimizeImportsTest extends LightCodeInsightTestCase {
|
||||
}
|
||||
|
||||
public void testUnusedImports() throws Exception {
|
||||
doTestWithKotlinRuntime();
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testWithAliases() throws Exception {
|
||||
@@ -86,23 +78,9 @@ public class OptimizeImportsTest extends LightCodeInsightTestCase {
|
||||
}
|
||||
|
||||
public void doTest() throws Exception {
|
||||
configureByFile(fileName());
|
||||
myFixture.configureByFile(fileName());
|
||||
invokeFormatFile();
|
||||
checkResultByFile(null, checkFileName(), true);
|
||||
}
|
||||
|
||||
public void doTestWithKotlinRuntime() {
|
||||
try {
|
||||
ConfigLibraryUtil.configureKotlinRuntime(getModule(), getFullJavaJDK());
|
||||
|
||||
configureByFile(fileName());
|
||||
invokeFormatFile();
|
||||
|
||||
checkResultByFile(null, checkFileName(), false);
|
||||
}
|
||||
finally {
|
||||
ConfigLibraryUtil.unConfigureKotlinRuntime(getModule(), getProjectJDK());
|
||||
}
|
||||
myFixture.checkResultByFile(checkFileName(), false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -111,26 +89,12 @@ public class OptimizeImportsTest extends LightCodeInsightTestCase {
|
||||
File.separator;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Sdk getProjectJDK() {
|
||||
return PluginTestCaseBase.jdkFromIdeaHome();
|
||||
}
|
||||
|
||||
protected static Sdk getFullJavaJDK() {
|
||||
return JavaSdk.getInstance().createJdk("JDK", SystemUtils.getJavaHome().getAbsolutePath());
|
||||
}
|
||||
|
||||
public String fileName() {
|
||||
return getTestName(false) + ".kt";
|
||||
}
|
||||
|
||||
public String checkFileName() {
|
||||
return getTestName(false) + "_after.kt";
|
||||
}
|
||||
|
||||
private static void invokeFormatFile() {
|
||||
CommandProcessor.getInstance().executeCommand(
|
||||
getProject(), new JetImportOptimizer().processFile(getFile()),
|
||||
private void invokeFormatFile() {
|
||||
CommandProcessor.getInstance().executeCommand(myFixture.getProject(), new JetImportOptimizer().processFile(myFixture.getFile()),
|
||||
"Optimize Imports", null, UndoConfirmationPolicy.DO_NOT_REQUEST_CONFIRMATION);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,17 +20,16 @@ import com.intellij.psi.*;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.testFramework.LightProjectDescriptor;
|
||||
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.asJava.KotlinLightClass;
|
||||
import org.jetbrains.jet.asJava.LightClassUtil;
|
||||
import org.jetbrains.jet.lang.psi.JetClass;
|
||||
import org.jetbrains.jet.lang.psi.JetNamedFunction;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.resolve.java.JvmAbi;
|
||||
import org.jetbrains.jet.plugin.JetLightCodeInsightFixtureTestCase;
|
||||
import org.jetbrains.jet.plugin.JetLightProjectDescriptor;
|
||||
import org.jetbrains.jet.plugin.PluginTestCaseBase;
|
||||
|
||||
public class JetJavaFacadeTest extends LightCodeInsightFixtureTestCase {
|
||||
public class JetJavaFacadeTest extends JetLightCodeInsightFixtureTestCase {
|
||||
@NotNull
|
||||
@Override
|
||||
protected LightProjectDescriptor getProjectDescriptor() {
|
||||
@@ -40,7 +39,11 @@ public class JetJavaFacadeTest extends LightCodeInsightFixtureTestCase {
|
||||
@Override
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
myFixture.setTestDataPath(PluginTestCaseBase.getTestDataPathBase() + "/javaFacade");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getTestDataPath() {
|
||||
return PluginTestCaseBase.getTestDataPathBase() + "/javaFacade";
|
||||
}
|
||||
|
||||
public void testDoNotWrapFunFromLocalClass() {
|
||||
@@ -51,6 +54,10 @@ public class JetJavaFacadeTest extends LightCodeInsightFixtureTestCase {
|
||||
doTestWrapMethod(false);
|
||||
}
|
||||
|
||||
public void testWrapFunInClassWithoutBody() {
|
||||
doTestWrapMethod(true);
|
||||
}
|
||||
|
||||
public void testWrapFunInClassObject() {
|
||||
doTestWrapMethod(true);
|
||||
}
|
||||
@@ -87,8 +94,52 @@ public class JetJavaFacadeTest extends LightCodeInsightFixtureTestCase {
|
||||
doTestWrapClass();
|
||||
}
|
||||
|
||||
public void testEa46019() {
|
||||
doTestWrapClass();
|
||||
}
|
||||
|
||||
public void testWrapTopLevelFunWithDefaultParams() {
|
||||
doTestWrapMethod(true);
|
||||
}
|
||||
|
||||
public void testWrapValTopLevelProperty() {
|
||||
doTestWrapProperty(true, false);
|
||||
}
|
||||
|
||||
public void testWrapVarPropertyInClass() {
|
||||
doTestWrapProperty(true, true);
|
||||
}
|
||||
|
||||
public void testWrapVarPropertyWithAccessorsInTrait() {
|
||||
doTestWrapProperty(true, true);
|
||||
}
|
||||
|
||||
public void testWrapVarTopLevelProperty() {
|
||||
doTestWrapProperty(true, true);
|
||||
}
|
||||
|
||||
public void testWrapVarPropertyInLocalClass() {
|
||||
doTestWrapProperty(false, false);
|
||||
}
|
||||
|
||||
public void testWrapVarTopLevelAccessor() {
|
||||
doTestWrapPropertyAccessor(true);
|
||||
}
|
||||
|
||||
public void testWrapConstructorField() {
|
||||
doTestWrapParameter(true, true);
|
||||
}
|
||||
|
||||
public void testWrapConstructorParameter() {
|
||||
doTestWrapParameter(false, false);
|
||||
}
|
||||
|
||||
public void testWrapFunctionParameter() {
|
||||
doTestWrapParameter(false, false);
|
||||
}
|
||||
|
||||
public void testEa38770() {
|
||||
myFixture.configureByFile(getTestName(true) + ".kt");
|
||||
myFixture.configureByFile(fileName());
|
||||
|
||||
PsiReference reference = myFixture.getFile().findReferenceAt(myFixture.getCaretOffset());
|
||||
assertNotNull(reference);
|
||||
@@ -101,7 +152,7 @@ public class JetJavaFacadeTest extends LightCodeInsightFixtureTestCase {
|
||||
}
|
||||
|
||||
public void testInnerClass() throws Exception {
|
||||
myFixture.configureByFile(getTestName(true) + ".kt");
|
||||
myFixture.configureByFile(fileName());
|
||||
|
||||
JavaPsiFacade facade = myFixture.getJavaFacade();
|
||||
PsiClass mirrorClass = facade.findClass("foo.Outer.Inner", GlobalSearchScope.allScope(getProject()));
|
||||
@@ -113,7 +164,7 @@ public class JetJavaFacadeTest extends LightCodeInsightFixtureTestCase {
|
||||
}
|
||||
|
||||
public void testClassObject() throws Exception {
|
||||
myFixture.configureByFile(getTestName(true) + ".kt");
|
||||
myFixture.configureByFile(fileName());
|
||||
|
||||
JavaPsiFacade facade = myFixture.getJavaFacade();
|
||||
PsiClass theClass = facade.findClass("foo.TheClass", GlobalSearchScope.allScope(getProject()));
|
||||
@@ -141,7 +192,7 @@ public class JetJavaFacadeTest extends LightCodeInsightFixtureTestCase {
|
||||
}
|
||||
|
||||
public void testLightClassIsNotCreatedForBuiltins() throws Exception {
|
||||
myFixture.configureByFile(getTestName(true) + ".kt");
|
||||
myFixture.configureByFile(fileName());
|
||||
|
||||
PsiReference reference = myFixture.getFile().findReferenceAt(myFixture.getCaretOffset());
|
||||
assert reference != null;
|
||||
@@ -154,23 +205,68 @@ public class JetJavaFacadeTest extends LightCodeInsightFixtureTestCase {
|
||||
}
|
||||
|
||||
private void doTestWrapMethod(boolean shouldBeWrapped) {
|
||||
myFixture.configureByFile(getTestName(true) + ".kt");
|
||||
JetNamedFunction jetFunction = getPreparedElement(JetNamedFunction.class);
|
||||
|
||||
// Should not fail!
|
||||
PsiMethod psiMethod = LightClassUtil.getLightClassMethod(jetFunction);
|
||||
|
||||
checkDeclarationMethodWrapped(shouldBeWrapped, jetFunction, psiMethod);
|
||||
}
|
||||
|
||||
private void doTestWrapParameter(boolean shouldWrapGetter, boolean shouldWrapSetter) {
|
||||
JetParameter jetParameter = getPreparedElement(JetParameter.class);
|
||||
|
||||
// Should not fail!
|
||||
LightClassUtil.PropertyAccessorsPsiMethods propertyAccessors = LightClassUtil.getLightClassPropertyMethods(jetParameter);
|
||||
|
||||
checkDeclarationMethodWrapped(shouldWrapGetter, jetParameter, propertyAccessors.getGetter());
|
||||
checkDeclarationMethodWrapped(shouldWrapSetter, jetParameter, propertyAccessors.getSetter());
|
||||
}
|
||||
|
||||
private void doTestWrapProperty(boolean shouldWrapGetter, boolean shouldWrapSetter) {
|
||||
JetProperty jetProperty = getPreparedElement(JetProperty.class);
|
||||
|
||||
// Should not fail!
|
||||
LightClassUtil.PropertyAccessorsPsiMethods propertyAccessors = LightClassUtil.getLightClassPropertyMethods(jetProperty);
|
||||
|
||||
JetPropertyAccessor getter = jetProperty.getGetter();
|
||||
JetPropertyAccessor setter = jetProperty.getSetter();
|
||||
|
||||
checkDeclarationMethodWrapped(shouldWrapGetter, getter != null ? getter : jetProperty, propertyAccessors.getGetter());
|
||||
checkDeclarationMethodWrapped(shouldWrapSetter, setter != null ? setter : jetProperty, propertyAccessors.getSetter());
|
||||
}
|
||||
|
||||
private void doTestWrapPropertyAccessor(boolean shouldWrapAccessor) {
|
||||
JetPropertyAccessor jetPropertyAccessor = getPreparedElement(JetPropertyAccessor.class);
|
||||
|
||||
// Should not fail!
|
||||
PsiMethod propertyAccessors = LightClassUtil.getLightClassAccessorMethod(jetPropertyAccessor);
|
||||
checkDeclarationMethodWrapped(shouldWrapAccessor, jetPropertyAccessor, propertyAccessors);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private <T extends JetElement> T getPreparedElement(Class<T> elementClass) {
|
||||
myFixture.configureByFile(fileName());
|
||||
|
||||
int offset = myFixture.getEditor().getCaretModel().getOffset();
|
||||
PsiElement elementAt = myFixture.getFile().findElementAt(offset);
|
||||
|
||||
assertNotNull("Caret should be set for tested file", elementAt);
|
||||
|
||||
JetNamedFunction jetFunction = PsiTreeUtil.getParentOfType(elementAt, JetNamedFunction.class);
|
||||
assertNotNull("Caret should be placed to function definition", jetFunction);
|
||||
T caretElement = PsiTreeUtil.getParentOfType(elementAt, elementClass);
|
||||
assertNotNull(
|
||||
String.format("Caret should be placed to element of type: %s, but was at element '%s' of type %s",
|
||||
elementClass, elementAt, elementAt.getClass()),
|
||||
caretElement);
|
||||
|
||||
// Should not fail!
|
||||
PsiMethod psiMethod = LightClassUtil.getLightClassMethod(jetFunction);
|
||||
return caretElement;
|
||||
}
|
||||
|
||||
private static void checkDeclarationMethodWrapped(boolean shouldBeWrapped, JetDeclaration declaration, PsiMethod psiMethod) {
|
||||
if (shouldBeWrapped) {
|
||||
assertNotNull(String.format("Failed to wrap jetFunction '%s' to method", jetFunction.getText()), psiMethod);
|
||||
assertNotNull(String.format("Failed to wrap declaration '%s' to method", declaration.getText()), psiMethod);
|
||||
assertInstanceOf(psiMethod, PsiCompiledElement.class);
|
||||
assertEquals("Invalid original element for generated method", ((PsiCompiledElement) psiMethod).getMirror(), jetFunction);
|
||||
assertEquals("Invalid original element for generated method", ((PsiCompiledElement) psiMethod).getMirror(), declaration);
|
||||
}
|
||||
else {
|
||||
assertNull("There should be no wrapper for given method", psiMethod);
|
||||
@@ -178,7 +274,7 @@ public class JetJavaFacadeTest extends LightCodeInsightFixtureTestCase {
|
||||
}
|
||||
|
||||
private void doTestWrapClass() {
|
||||
myFixture.configureByFile(getTestName(true) + ".kt");
|
||||
myFixture.configureByFile(fileName());
|
||||
|
||||
int offset = myFixture.getEditor().getCaretModel().getOffset();
|
||||
PsiElement elementAt = myFixture.getFile().findElementAt(offset);
|
||||
@@ -197,4 +293,9 @@ public class JetJavaFacadeTest extends LightCodeInsightFixtureTestCase {
|
||||
// No exception/error should happen here
|
||||
lightClass.getDelegate();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String fileName() {
|
||||
return getTestName(true) + ".kt";
|
||||
}
|
||||
}
|
||||
|
||||
+1
-3
@@ -22,7 +22,6 @@ import com.intellij.openapi.roots.ContentEntry;
|
||||
import com.intellij.openapi.roots.ModifiableRootModel;
|
||||
import com.intellij.openapi.roots.OrderRootType;
|
||||
import com.intellij.openapi.roots.libraries.Library;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.vfs.VfsUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiClass;
|
||||
@@ -33,7 +32,6 @@ import com.intellij.testFramework.LightPlatformTestCase;
|
||||
import com.intellij.testFramework.LightProjectDescriptor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.codegen.binding.PsiCodegenPredictor;
|
||||
import org.jetbrains.jet.lang.psi.JetClass;
|
||||
import org.jetbrains.jet.lang.psi.JetPsiUtil;
|
||||
import org.jetbrains.jet.plugin.JetWithJdkAndRuntimeLightProjectDescriptor;
|
||||
@@ -98,7 +96,7 @@ public class NavigateToStdlibSourceRegressionTest extends NavigateToLibraryRegre
|
||||
assertEquals(expectedName, ((PsiClass) element).getQualifiedName());
|
||||
}
|
||||
else if (element instanceof JetClass) {
|
||||
assertEquals(expectedName, JetPsiUtil.getFQName((JetClass) element).getFqName());
|
||||
assertEquals(expectedName, JetPsiUtil.getFQName((JetClass) element).asString());
|
||||
}
|
||||
else {
|
||||
fail("Navigation element should be JetClass or PsiClass: " + element.getClass() + ", " + element.getText());
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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.navigation;
|
||||
|
||||
import com.intellij.codeInsight.CodeInsightActionHandler;
|
||||
import com.intellij.openapi.actionSystem.ActionManager;
|
||||
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.JetTestUtils;
|
||||
import org.jetbrains.jet.plugin.JetFileType;
|
||||
import org.jetbrains.jet.plugin.PluginTestCaseBase;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class JetAbstractGotoSuperTest extends LightCodeInsightFixtureTestCase {
|
||||
protected void doTest(String testPath) {
|
||||
List<String> parts = JetTestUtils.loadBeforeAfterText(testPath);
|
||||
|
||||
myFixture.configureByText(JetFileType.INSTANCE, parts.get(0));
|
||||
|
||||
CodeInsightActionHandler gotoSuperAction = (CodeInsightActionHandler) ActionManager.getInstance().getAction("GotoSuperMethod");
|
||||
gotoSuperAction.invoke(getProject(), myFixture.getEditor(), myFixture.getFile());
|
||||
|
||||
myFixture.checkResult(parts.get(1));
|
||||
}
|
||||
}
|
||||
@@ -39,6 +39,10 @@ public class JetGotoImplementationMultifileTest extends CodeInsightTestCase {
|
||||
doKotlinJavaTest();
|
||||
}
|
||||
|
||||
public void testImplementVarInJava() throws Exception {
|
||||
doKotlinJavaTest();
|
||||
}
|
||||
|
||||
private void doKotlinJavaTest() throws Exception {
|
||||
doMultifileTest(getTestName(false) + ".kt", getTestName(false) + ".java");
|
||||
}
|
||||
|
||||
@@ -37,6 +37,14 @@ public class JetGotoImplementationTest extends LightCodeInsightTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testPropertyOverriddenNavigation() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testConstructorPropertyOverriddenNavigation() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTestDataPath() {
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* 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.navigation;
|
||||
|
||||
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.navigation.JetAbstractGotoSuperTest;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.jet.generators.tests.GenerateTests}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("idea/testData/navigation/gotoSuper")
|
||||
public class JetGotoSuperTestGenerated extends JetAbstractGotoSuperTest {
|
||||
public void testAllFilesPresentInGotoSuper() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/navigation/gotoSuper"), Pattern.compile("^(.+)\\.test$"), false);
|
||||
}
|
||||
|
||||
@TestMetadata("ClassSimple.test")
|
||||
public void testClassSimple() throws Exception {
|
||||
doTest("idea/testData/navigation/gotoSuper/ClassSimple.test");
|
||||
}
|
||||
|
||||
@TestMetadata("FunctionSimple.test")
|
||||
public void testFunctionSimple() throws Exception {
|
||||
doTest("idea/testData/navigation/gotoSuper/FunctionSimple.test");
|
||||
}
|
||||
|
||||
@TestMetadata("ObjectSimple.test")
|
||||
public void testObjectSimple() throws Exception {
|
||||
doTest("idea/testData/navigation/gotoSuper/ObjectSimple.test");
|
||||
}
|
||||
|
||||
@TestMetadata("PropertySimple.test")
|
||||
public void testPropertySimple() throws Exception {
|
||||
doTest("idea/testData/navigation/gotoSuper/PropertySimple.test");
|
||||
}
|
||||
|
||||
@TestMetadata("TraitSimple.test")
|
||||
public void testTraitSimple() throws Exception {
|
||||
doTest("idea/testData/navigation/gotoSuper/TraitSimple.test");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -16,40 +16,12 @@
|
||||
|
||||
package org.jetbrains.jet.plugin.navigation;
|
||||
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.module.ModuleType;
|
||||
import com.intellij.openapi.module.StdModuleTypes;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.roots.ContentEntry;
|
||||
import com.intellij.openapi.roots.ModifiableRootModel;
|
||||
import com.intellij.testFramework.LightProjectDescriptor;
|
||||
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.plugin.JetLightCodeInsightFixtureTestCase;
|
||||
import org.jetbrains.jet.plugin.PluginTestCaseBase;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class JetGotoSymbolTest extends LightCodeInsightFixtureTestCase {
|
||||
@NotNull
|
||||
@Override
|
||||
protected LightProjectDescriptor getProjectDescriptor() {
|
||||
return new LightProjectDescriptor() {
|
||||
@Override
|
||||
public ModuleType getModuleType() {
|
||||
return StdModuleTypes.JAVA;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Sdk getSdk() {
|
||||
return PluginTestCaseBase.jdkFromIdeaHome();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configureModule(Module module, ModifiableRootModel model, ContentEntry contentEntry) {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public class JetGotoSymbolTest extends JetLightCodeInsightFixtureTestCase {
|
||||
public void testProperties() {
|
||||
doTest();
|
||||
}
|
||||
@@ -64,9 +36,12 @@ public class JetGotoSymbolTest extends LightCodeInsightFixtureTestCase {
|
||||
}
|
||||
|
||||
protected void doTest() {
|
||||
String fileName = getTestName(true) + ".kt";
|
||||
myFixture.configureByFile(fileName);
|
||||
|
||||
myFixture.configureByFile(fileName());
|
||||
NavigationTestUtils.assertGotoSymbol(getProject(), myFixture.getEditor());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String fileName() {
|
||||
return getTestName(true) + ".kt";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,8 +19,8 @@ package org.jetbrains.jet.plugin.quickfix;
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.collect.Collections2;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Ordering;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.intellij.codeInsight.intention.IntentionAction;
|
||||
import com.intellij.testFramework.UsefulTestCase;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -73,16 +73,16 @@ public class QuickFixActionsUtils {
|
||||
|
||||
public static void checkAvailableActionsAreExpected(JetFile file, Collection<IntentionAction> availableActions) {
|
||||
List<String> validActions = Ordering.natural().sortedCopy(
|
||||
Sets.newHashSet(InTextDirectivesUtils.findLinesWithPrefixesRemoved(file.getText(), "// ACTION:")));
|
||||
Lists.newArrayList(InTextDirectivesUtils.findLinesWithPrefixesRemoved(file.getText(), "// ACTION:")));
|
||||
|
||||
Collection<String> actualActions = Ordering.natural().sortedCopy(
|
||||
Collections2.transform(availableActions, new Function<IntentionAction, String>() {
|
||||
Lists.newArrayList(Collections2.transform(availableActions, new Function<IntentionAction, String>() {
|
||||
@Override
|
||||
public String apply(@Nullable IntentionAction input) {
|
||||
assert input != null;
|
||||
return input.getText();
|
||||
}
|
||||
}));
|
||||
})));
|
||||
|
||||
UsefulTestCase.assertOrderedEquals("Some unexpected actions available at current position: %s. Use // ACTION: directive",
|
||||
actualActions, validActions);
|
||||
|
||||
@@ -422,6 +422,36 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/quickfix/checkArguments"), Pattern.compile("^before(\\w+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("beforeMixedNamedAndPositionalArguments.kt")
|
||||
public void testMixedNamedAndPositionalArguments() throws Exception {
|
||||
doTest("idea/testData/quickfix/checkArguments/beforeMixedNamedAndPositionalArguments.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeMixedNamedAndPositionalArgumentsConstructor.kt")
|
||||
public void testMixedNamedAndPositionalArgumentsConstructor() throws Exception {
|
||||
doTest("idea/testData/quickfix/checkArguments/beforeMixedNamedAndPositionalArgumentsConstructor.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeMixedNamedAndPositionalArgumentsMultiple.kt")
|
||||
public void testMixedNamedAndPositionalArgumentsMultiple() throws Exception {
|
||||
doTest("idea/testData/quickfix/checkArguments/beforeMixedNamedAndPositionalArgumentsMultiple.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeMixedNamedAndPositionalArgumentsSubtype.kt")
|
||||
public void testMixedNamedAndPositionalArgumentsSubtype() throws Exception {
|
||||
doTest("idea/testData/quickfix/checkArguments/beforeMixedNamedAndPositionalArgumentsSubtype.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeMixedNamedAndPositionalArgumentsUsedNamed.kt")
|
||||
public void testMixedNamedAndPositionalArgumentsUsedNamed() throws Exception {
|
||||
doTest("idea/testData/quickfix/checkArguments/beforeMixedNamedAndPositionalArgumentsUsedNamed.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeMixedNamedAndPositionalArgumentsUsedPositional.kt")
|
||||
public void testMixedNamedAndPositionalArgumentsUsedPositional() throws Exception {
|
||||
doTest("idea/testData/quickfix/checkArguments/beforeMixedNamedAndPositionalArgumentsUsedPositional.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeNonVarargSpread.kt")
|
||||
public void testNonVarargSpread() throws Exception {
|
||||
doTest("idea/testData/quickfix/checkArguments/beforeNonVarargSpread.kt");
|
||||
@@ -1029,11 +1059,51 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest {
|
||||
|
||||
@TestMetadata("idea/testData/quickfix/override/nothingToOverride")
|
||||
public static class NothingToOverride extends AbstractQuickFixTest {
|
||||
@TestMetadata("beforeAddFunction.kt")
|
||||
public void testAddFunction() throws Exception {
|
||||
doTest("idea/testData/quickfix/override/nothingToOverride/beforeAddFunction.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeAddFunctionAbstractClass.kt")
|
||||
public void testAddFunctionAbstractClass() throws Exception {
|
||||
doTest("idea/testData/quickfix/override/nothingToOverride/beforeAddFunctionAbstractClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeAddFunctionNoBody.kt")
|
||||
public void testAddFunctionNoBody() throws Exception {
|
||||
doTest("idea/testData/quickfix/override/nothingToOverride/beforeAddFunctionNoBody.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeAddFunctionNonUnitReturnType.kt")
|
||||
public void testAddFunctionNonUnitReturnType() throws Exception {
|
||||
doTest("idea/testData/quickfix/override/nothingToOverride/beforeAddFunctionNonUnitReturnType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeAddFunctionTrait.kt")
|
||||
public void testAddFunctionTrait() throws Exception {
|
||||
doTest("idea/testData/quickfix/override/nothingToOverride/beforeAddFunctionTrait.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeAddFunctionTwoSuperclasses.kt")
|
||||
public void testAddFunctionTwoSuperclasses() throws Exception {
|
||||
doTest("idea/testData/quickfix/override/nothingToOverride/beforeAddFunctionTwoSuperclasses.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeAddFunctionTwoTraits.kt")
|
||||
public void testAddFunctionTwoTraits() throws Exception {
|
||||
doTest("idea/testData/quickfix/override/nothingToOverride/beforeAddFunctionTwoTraits.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeAddParameter.kt")
|
||||
public void testAddParameter() throws Exception {
|
||||
doTest("idea/testData/quickfix/override/nothingToOverride/beforeAddParameter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeAddParameterGenericClass.kt")
|
||||
public void testAddParameterGenericClass() throws Exception {
|
||||
doTest("idea/testData/quickfix/override/nothingToOverride/beforeAddParameterGenericClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeAddParameterMultiple.kt")
|
||||
public void testAddParameterMultiple() throws Exception {
|
||||
doTest("idea/testData/quickfix/override/nothingToOverride/beforeAddParameterMultiple.kt");
|
||||
@@ -1044,6 +1114,16 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest {
|
||||
doTest("idea/testData/quickfix/override/nothingToOverride/beforeAddParameterPreserveVisibility.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeAddParameterTwoSupertraits.kt")
|
||||
public void testAddParameterTwoSupertraits() throws Exception {
|
||||
doTest("idea/testData/quickfix/override/nothingToOverride/beforeAddParameterTwoSupertraits.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeAddParameterTwoSupertypes.kt")
|
||||
public void testAddParameterTwoSupertypes() throws Exception {
|
||||
doTest("idea/testData/quickfix/override/nothingToOverride/beforeAddParameterTwoSupertypes.kt");
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInNothingToOverride() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/quickfix/override/nothingToOverride"), Pattern.compile("^before(\\w+)\\.kt$"), true);
|
||||
}
|
||||
@@ -1118,6 +1198,11 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest {
|
||||
doTest("idea/testData/quickfix/override/nothingToOverride/beforeRemoveParameterTwoTraits.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeSwapParametersGenericClass.kt")
|
||||
public void testSwapParametersGenericClass() throws Exception {
|
||||
doTest("idea/testData/quickfix/override/nothingToOverride/beforeSwapParametersGenericClass.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/quickfix/override/typeMismatchOnOverride")
|
||||
@@ -1126,6 +1211,46 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/quickfix/override/typeMismatchOnOverride"), Pattern.compile("^before(\\w+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("beforeCantChangeMultipleOverriddenPropertiesTypes.kt")
|
||||
public void testCantChangeMultipleOverriddenPropertiesTypes() throws Exception {
|
||||
doTest("idea/testData/quickfix/override/typeMismatchOnOverride/beforeCantChangeMultipleOverriddenPropertiesTypes.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeCantChangeOverriddenPropertyTypeToMatchOverridingProperty.kt")
|
||||
public void testCantChangeOverriddenPropertyTypeToMatchOverridingProperty() throws Exception {
|
||||
doTest("idea/testData/quickfix/override/typeMismatchOnOverride/beforeCantChangeOverriddenPropertyTypeToMatchOverridingProperty.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeCantChangePropertyTypeToMatchOverridenProperties.kt")
|
||||
public void testCantChangePropertyTypeToMatchOverridenProperties() throws Exception {
|
||||
doTest("idea/testData/quickfix/override/typeMismatchOnOverride/beforeCantChangePropertyTypeToMatchOverridenProperties.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeCantChangeReturnTypeOfOverriddenFunction.kt")
|
||||
public void testCantChangeReturnTypeOfOverriddenFunction() throws Exception {
|
||||
doTest("idea/testData/quickfix/override/typeMismatchOnOverride/beforeCantChangeReturnTypeOfOverriddenFunction.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeChangeOverriddenPropertyType1.kt")
|
||||
public void testChangeOverriddenPropertyType1() throws Exception {
|
||||
doTest("idea/testData/quickfix/override/typeMismatchOnOverride/beforeChangeOverriddenPropertyType1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeChangeOverriddenPropertyType2.kt")
|
||||
public void testChangeOverriddenPropertyType2() throws Exception {
|
||||
doTest("idea/testData/quickfix/override/typeMismatchOnOverride/beforeChangeOverriddenPropertyType2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeChangeOverridingPropertyTypeToFunctionType.kt")
|
||||
public void testChangeOverridingPropertyTypeToFunctionType() throws Exception {
|
||||
doTest("idea/testData/quickfix/override/typeMismatchOnOverride/beforeChangeOverridingPropertyTypeToFunctionType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeChangeReturnTypeOfOverriddenFunction.kt")
|
||||
public void testChangeReturnTypeOfOverriddenFunction() throws Exception {
|
||||
doTest("idea/testData/quickfix/override/typeMismatchOnOverride/beforeChangeReturnTypeOfOverriddenFunction.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforePropertyReturnTypeMismatchOnOverride.kt")
|
||||
public void testPropertyReturnTypeMismatchOnOverride() throws Exception {
|
||||
doTest("idea/testData/quickfix/override/typeMismatchOnOverride/beforePropertyReturnTypeMismatchOnOverride.kt");
|
||||
@@ -1257,6 +1382,11 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest {
|
||||
doTest("idea/testData/quickfix/typeAddition/beforeAmbiguousPropertyReturnType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeChangeAccessorTypeToFunctionType.kt")
|
||||
public void testChangeAccessorTypeToFunctionType() throws Exception {
|
||||
doTest("idea/testData/quickfix/typeAddition/beforeChangeAccessorTypeToFunctionType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeNoAddErrorType.kt")
|
||||
public void testNoAddErrorType() throws Exception {
|
||||
doTest("idea/testData/quickfix/typeAddition/beforeNoAddErrorType.kt");
|
||||
@@ -1338,12 +1468,22 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest {
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/quickfix/typeMismatch")
|
||||
@InnerTestClasses({TypeMismatch.Casts.class})
|
||||
@InnerTestClasses({TypeMismatch.Casts.class, TypeMismatch.ComponentFunctionReturnTypeMismatch.class, TypeMismatch.FixOverloadedOperator.class, TypeMismatch.ParameterTypeMismatch.class, TypeMismatch.TypeMismatchOnReturnedExpression.class})
|
||||
public static class TypeMismatch extends AbstractQuickFixTest {
|
||||
public void testAllFilesPresentInTypeMismatch() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/quickfix/typeMismatch"), Pattern.compile("^before(\\w+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("beforeChangeFunctionLiteralParameterTypeToFunctionType.kt")
|
||||
public void testChangeFunctionLiteralParameterTypeToFunctionType() throws Exception {
|
||||
doTest("idea/testData/quickfix/typeMismatch/beforeChangeFunctionLiteralParameterTypeToFunctionType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeChangeFunctionReturnTypeToMatchExpectedTypeOfCall.kt")
|
||||
public void testChangeFunctionReturnTypeToMatchExpectedTypeOfCall() throws Exception {
|
||||
doTest("idea/testData/quickfix/typeMismatch/beforeChangeFunctionReturnTypeToMatchExpectedTypeOfCall.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeChangeReturnTypeWhenFunctionNameIsMissing.kt")
|
||||
public void testChangeReturnTypeWhenFunctionNameIsMissing() throws Exception {
|
||||
doTest("idea/testData/quickfix/typeMismatch/beforeChangeReturnTypeWhenFunctionNameIsMissing.kt");
|
||||
@@ -1359,29 +1499,9 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest {
|
||||
doTest("idea/testData/quickfix/typeMismatch/beforeCompareToTypeMismatch.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeComponentFunctionReturnTypeMismatch1.kt")
|
||||
public void testComponentFunctionReturnTypeMismatch1() throws Exception {
|
||||
doTest("idea/testData/quickfix/typeMismatch/beforeComponentFunctionReturnTypeMismatch1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeComponentFunctionReturnTypeMismatch2.kt")
|
||||
public void testComponentFunctionReturnTypeMismatch2() throws Exception {
|
||||
doTest("idea/testData/quickfix/typeMismatch/beforeComponentFunctionReturnTypeMismatch2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeComponentFunctionReturnTypeMismatch3.kt")
|
||||
public void testComponentFunctionReturnTypeMismatch3() throws Exception {
|
||||
doTest("idea/testData/quickfix/typeMismatch/beforeComponentFunctionReturnTypeMismatch3.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeComponentFunctionReturnTypeMismatch4.kt")
|
||||
public void testComponentFunctionReturnTypeMismatch4() throws Exception {
|
||||
doTest("idea/testData/quickfix/typeMismatch/beforeComponentFunctionReturnTypeMismatch4.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeComponentFunctionReturnTypeMismatch5.kt")
|
||||
public void testComponentFunctionReturnTypeMismatch5() throws Exception {
|
||||
doTest("idea/testData/quickfix/typeMismatch/beforeComponentFunctionReturnTypeMismatch5.kt");
|
||||
@TestMetadata("beforeDontChangeOverriddenPropertyTypeToErrorType.kt")
|
||||
public void testDontChangeOverriddenPropertyTypeToErrorType() throws Exception {
|
||||
doTest("idea/testData/quickfix/typeMismatch/beforeDontChangeOverriddenPropertyTypeToErrorType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeExpectedParameterTypeMismatch.kt")
|
||||
@@ -1404,21 +1524,16 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest {
|
||||
doTest("idea/testData/quickfix/typeMismatch/beforeNoReturnInFunctionWithBlockBody.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforePropertyTypeMismatch.kt")
|
||||
public void testPropertyTypeMismatch() throws Exception {
|
||||
doTest("idea/testData/quickfix/typeMismatch/beforePropertyTypeMismatch.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeReturnTypeMismatch.kt")
|
||||
public void testReturnTypeMismatch() throws Exception {
|
||||
doTest("idea/testData/quickfix/typeMismatch/beforeReturnTypeMismatch.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeTypeMismatchInInitializer.kt")
|
||||
public void testTypeMismatchInInitializer() throws Exception {
|
||||
doTest("idea/testData/quickfix/typeMismatch/beforeTypeMismatchInInitializer.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeTypeMismatchInReturnStatement.kt")
|
||||
public void testTypeMismatchInReturnStatement() throws Exception {
|
||||
doTest("idea/testData/quickfix/typeMismatch/beforeTypeMismatchInReturnStatement.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/quickfix/typeMismatch/casts")
|
||||
public static class Casts extends AbstractQuickFixTest {
|
||||
public void testAllFilesPresentInCasts() throws Exception {
|
||||
@@ -1440,6 +1555,11 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest {
|
||||
doTest("idea/testData/quickfix/typeMismatch/casts/beforeAutocastImpossible3.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeCastToFunctionType.kt")
|
||||
public void testCastToFunctionType() throws Exception {
|
||||
doTest("idea/testData/quickfix/typeMismatch/casts/beforeCastToFunctionType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeTypeMismatch1.kt")
|
||||
public void testTypeMismatch1() throws Exception {
|
||||
doTest("idea/testData/quickfix/typeMismatch/casts/beforeTypeMismatch1.kt");
|
||||
@@ -1467,10 +1587,186 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest {
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/quickfix/typeMismatch/componentFunctionReturnTypeMismatch")
|
||||
public static class ComponentFunctionReturnTypeMismatch extends AbstractQuickFixTest {
|
||||
public void testAllFilesPresentInComponentFunctionReturnTypeMismatch() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/quickfix/typeMismatch/componentFunctionReturnTypeMismatch"), Pattern.compile("^before(\\w+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("beforeComponentFunctionReturnTypeMismatch1.kt")
|
||||
public void testComponentFunctionReturnTypeMismatch1() throws Exception {
|
||||
doTest("idea/testData/quickfix/typeMismatch/componentFunctionReturnTypeMismatch/beforeComponentFunctionReturnTypeMismatch1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeComponentFunctionReturnTypeMismatch2.kt")
|
||||
public void testComponentFunctionReturnTypeMismatch2() throws Exception {
|
||||
doTest("idea/testData/quickfix/typeMismatch/componentFunctionReturnTypeMismatch/beforeComponentFunctionReturnTypeMismatch2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeComponentFunctionReturnTypeMismatch3.kt")
|
||||
public void testComponentFunctionReturnTypeMismatch3() throws Exception {
|
||||
doTest("idea/testData/quickfix/typeMismatch/componentFunctionReturnTypeMismatch/beforeComponentFunctionReturnTypeMismatch3.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeComponentFunctionReturnTypeMismatch4.kt")
|
||||
public void testComponentFunctionReturnTypeMismatch4() throws Exception {
|
||||
doTest("idea/testData/quickfix/typeMismatch/componentFunctionReturnTypeMismatch/beforeComponentFunctionReturnTypeMismatch4.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeComponentFunctionReturnTypeMismatch5.kt")
|
||||
public void testComponentFunctionReturnTypeMismatch5() throws Exception {
|
||||
doTest("idea/testData/quickfix/typeMismatch/componentFunctionReturnTypeMismatch/beforeComponentFunctionReturnTypeMismatch5.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/quickfix/typeMismatch/fixOverloadedOperator")
|
||||
public static class FixOverloadedOperator extends AbstractQuickFixTest {
|
||||
public void testAllFilesPresentInFixOverloadedOperator() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/quickfix/typeMismatch/fixOverloadedOperator"), Pattern.compile("^before(\\w+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("beforeChangeNotFunctionReturnType.kt")
|
||||
public void testChangeNotFunctionReturnType() throws Exception {
|
||||
doTest("idea/testData/quickfix/typeMismatch/fixOverloadedOperator/beforeChangeNotFunctionReturnType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeChangePlusFunctionReturnType.kt")
|
||||
public void testChangePlusFunctionReturnType() throws Exception {
|
||||
doTest("idea/testData/quickfix/typeMismatch/fixOverloadedOperator/beforeChangePlusFunctionReturnType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeChangeTimesFunctionParameterType.kt")
|
||||
public void testChangeTimesFunctionParameterType() throws Exception {
|
||||
doTest("idea/testData/quickfix/typeMismatch/fixOverloadedOperator/beforeChangeTimesFunctionParameterType.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/quickfix/typeMismatch/parameterTypeMismatch")
|
||||
public static class ParameterTypeMismatch extends AbstractQuickFixTest {
|
||||
public void testAllFilesPresentInParameterTypeMismatch() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/quickfix/typeMismatch/parameterTypeMismatch"), Pattern.compile("^before(\\w+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("beforeChangeFunctionParameterType1.kt")
|
||||
public void testChangeFunctionParameterType1() throws Exception {
|
||||
doTest("idea/testData/quickfix/typeMismatch/parameterTypeMismatch/beforeChangeFunctionParameterType1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeChangeFunctionParameterType2.kt")
|
||||
public void testChangeFunctionParameterType2() throws Exception {
|
||||
doTest("idea/testData/quickfix/typeMismatch/parameterTypeMismatch/beforeChangeFunctionParameterType2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeChangeFunctionParameterType3.kt")
|
||||
public void testChangeFunctionParameterType3() throws Exception {
|
||||
doTest("idea/testData/quickfix/typeMismatch/parameterTypeMismatch/beforeChangeFunctionParameterType3.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeChangeFunctionParameterType4.kt")
|
||||
public void testChangeFunctionParameterType4() throws Exception {
|
||||
doTest("idea/testData/quickfix/typeMismatch/parameterTypeMismatch/beforeChangeFunctionParameterType4.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeChangeFunctionParameterType5.kt")
|
||||
public void testChangeFunctionParameterType5() throws Exception {
|
||||
doTest("idea/testData/quickfix/typeMismatch/parameterTypeMismatch/beforeChangeFunctionParameterType5.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeChangePrimaryConstructorParameterType.kt")
|
||||
public void testChangePrimaryConstructorParameterType() throws Exception {
|
||||
doTest("idea/testData/quickfix/typeMismatch/parameterTypeMismatch/beforeChangePrimaryConstructorParameterType.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression")
|
||||
public static class TypeMismatchOnReturnedExpression extends AbstractQuickFixTest {
|
||||
public void testAllFilesPresentInTypeMismatchOnReturnedExpression() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression"), Pattern.compile("^before(\\w+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("beforeAssignmentTypeMismatch.kt")
|
||||
public void testAssignmentTypeMismatch() throws Exception {
|
||||
doTest("idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/beforeAssignmentTypeMismatch.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeChangeFunctionLiteralTypeWithoutChangingFunctionParameterType.kt")
|
||||
public void testChangeFunctionLiteralTypeWithoutChangingFunctionParameterType() throws Exception {
|
||||
doTest("idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/beforeChangeFunctionLiteralTypeWithoutChangingFunctionParameterType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeChangeFunctionLiteralTypeWithoutChangingPropertyType.kt")
|
||||
public void testChangeFunctionLiteralTypeWithoutChangingPropertyType() throws Exception {
|
||||
doTest("idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/beforeChangeFunctionLiteralTypeWithoutChangingPropertyType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeChangeFunctionReturnTypeToFunctionType.kt")
|
||||
public void testChangeFunctionReturnTypeToFunctionType() throws Exception {
|
||||
doTest("idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/beforeChangeFunctionReturnTypeToFunctionType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeChangeFunctionReturnTypeToMatchReturnTypeOfReturnedLiteral.kt")
|
||||
public void testChangeFunctionReturnTypeToMatchReturnTypeOfReturnedLiteral() throws Exception {
|
||||
doTest("idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/beforeChangeFunctionReturnTypeToMatchReturnTypeOfReturnedLiteral.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeDontChangeFunctionReturnTypeToErrorType.kt")
|
||||
public void testDontChangeFunctionReturnTypeToErrorType() throws Exception {
|
||||
doTest("idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/beforeDontChangeFunctionReturnTypeToErrorType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeExpectedTypeMismatch.kt")
|
||||
public void testExpectedTypeMismatch() throws Exception {
|
||||
doTest("idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/beforeExpectedTypeMismatch.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforePropertyGetterInitializerTypeMismatch.kt")
|
||||
public void testPropertyGetterInitializerTypeMismatch() throws Exception {
|
||||
doTest("idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/beforePropertyGetterInitializerTypeMismatch.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeReturnedExpresionCantEvaluateToExpresionThatTypeMismatch.kt")
|
||||
public void testReturnedExpresionCantEvaluateToExpresionThatTypeMismatch() throws Exception {
|
||||
doTest("idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/beforeReturnedExpresionCantEvaluateToExpresionThatTypeMismatch.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeReturnedExpressionTypeMismatchFunctionParameterType.kt")
|
||||
public void testReturnedExpressionTypeMismatchFunctionParameterType() throws Exception {
|
||||
doTest("idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/beforeReturnedExpressionTypeMismatchFunctionParameterType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeTypeMismatchInIfStatementReturnedByFunction.kt")
|
||||
public void testTypeMismatchInIfStatementReturnedByFunction() throws Exception {
|
||||
doTest("idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/beforeTypeMismatchInIfStatementReturnedByFunction.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeTypeMismatchInIfStatementReturnedByLiteral.kt")
|
||||
public void testTypeMismatchInIfStatementReturnedByLiteral() throws Exception {
|
||||
doTest("idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/beforeTypeMismatchInIfStatementReturnedByLiteral.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeTypeMismatchInInitializer.kt")
|
||||
public void testTypeMismatchInInitializer() throws Exception {
|
||||
doTest("idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/beforeTypeMismatchInInitializer.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("beforeTypeMismatchInReturnStatement.kt")
|
||||
public void testTypeMismatchInReturnStatement() throws Exception {
|
||||
doTest("idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/beforeTypeMismatchInReturnStatement.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static Test innerSuite() {
|
||||
TestSuite suite = new TestSuite("TypeMismatch");
|
||||
suite.addTestSuite(TypeMismatch.class);
|
||||
suite.addTestSuite(Casts.class);
|
||||
suite.addTestSuite(ComponentFunctionReturnTypeMismatch.class);
|
||||
suite.addTestSuite(FixOverloadedOperator.class);
|
||||
suite.addTestSuite(ParameterTypeMismatch.class);
|
||||
suite.addTestSuite(TypeMismatchOnReturnedExpression.class);
|
||||
return suite;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ public class BuiltInsReferenceResolverTest extends ResolveTestCase {
|
||||
public void testAllReferencesResolved() {
|
||||
BuiltInsReferenceResolver referenceResolver = getProject().getComponent(BuiltInsReferenceResolver.class);
|
||||
for (DeclarationDescriptor descriptor : getAllStandardDescriptors(KotlinBuiltIns.getInstance().getBuiltInsPackage())) {
|
||||
if (descriptor instanceof NamespaceDescriptor && "jet".equals(descriptor.getName().getName())) continue;
|
||||
if (descriptor instanceof NamespaceDescriptor && "jet".equals(descriptor.getName().asString())) continue;
|
||||
assertNotNull("Can't resolve " + descriptor, referenceResolver.resolveStandardLibrarySymbol(descriptor));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,6 +129,12 @@ public class JetStubsTest extends LightCodeInsightFixtureTestCase {
|
||||
" VALUE_PARAMETER_LIST:PsiJetParameterListStubImpl\n");
|
||||
}
|
||||
|
||||
public void testNotStorePropertyFromDelegate() {
|
||||
doBuildTest("val a by kotlin.\n val b = 1",
|
||||
"PsiJetFileStubImpl[package=]\n" +
|
||||
" PROPERTY:PsiJetPropertyStubImpl[val top topFQName=a name=a typeText=null bodyText=null]\n");
|
||||
}
|
||||
|
||||
public void testNotStorePropertiesFrom() {
|
||||
doBuildTest("class Test() {\n" +
|
||||
" val test = 12;\n" +
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* 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.psi;
|
||||
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.InTextDirectivesUtils;
|
||||
import org.jetbrains.jet.JetLiteFixture;
|
||||
import org.jetbrains.jet.cli.jvm.compiler.JetCoreEnvironment;
|
||||
import org.jetbrains.jet.config.CompilerConfiguration;
|
||||
import org.jetbrains.jet.lang.psi.JetExpression;
|
||||
import org.jetbrains.jet.lang.psi.JetPsiFactory;
|
||||
import org.jetbrains.jet.lang.psi.JetTypeReference;
|
||||
import org.jetbrains.jet.plugin.util.JetPsiMatcher;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public abstract class AbstractJetPsiMatcherTest extends JetLiteFixture {
|
||||
public void doTestExpressions(@NotNull String path) throws Exception {
|
||||
String fileText = FileUtil.loadFile(new File(path));
|
||||
String fileText2 = FileUtil.loadFile(new File(path + ".2"));
|
||||
|
||||
boolean equalityExpected = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// NOT_EQUAL") == null;
|
||||
|
||||
JetExpression expr = JetPsiFactory.createExpression(getProject(), fileText);
|
||||
JetExpression expr2 = JetPsiFactory.createExpression(getProject(), fileText2);
|
||||
|
||||
assertTrue(
|
||||
"JetPsiMatcher.checkElementMatch() should return " + equalityExpected,
|
||||
equalityExpected == JetPsiMatcher.checkElementMatch(expr, expr2)
|
||||
);
|
||||
}
|
||||
|
||||
public void doTestTypes(@NotNull String path) throws Exception {
|
||||
String fileText = FileUtil.loadFile(new File(path));
|
||||
String fileText2 = FileUtil.loadFile(new File(path + ".2"));
|
||||
|
||||
boolean equalityExpected = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// NOT_EQUAL") == null;
|
||||
|
||||
JetTypeReference typeRef = JetPsiFactory.createProperty(getProject(), fileText).getTypeRef();
|
||||
JetTypeReference typeRef2 = JetPsiFactory.createProperty(getProject(), fileText2).getTypeRef();
|
||||
|
||||
assertNotNull(typeRef);
|
||||
assertNotNull(typeRef2);
|
||||
|
||||
assertTrue(
|
||||
"JetPsiMatcher.checkElementMatch() should return " + equalityExpected,
|
||||
equalityExpected == JetPsiMatcher.checkElementMatch(typeRef, typeRef2)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JetCoreEnvironment createEnvironment() {
|
||||
return new JetCoreEnvironment(getTestRootDisposable(), new CompilerConfiguration());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,444 @@
|
||||
/*
|
||||
* 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.psi;
|
||||
|
||||
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.psi.AbstractJetPsiMatcherTest;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.jet.generators.tests.GenerateTests}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@InnerTestClasses({JetPsiMatcherTest.Expressions.class, JetPsiMatcherTest.Types.class})
|
||||
public class JetPsiMatcherTest extends AbstractJetPsiMatcherTest {
|
||||
@TestMetadata("idea/testData/jetPsiMatcher/expressions")
|
||||
@InnerTestClasses({Expressions.ArrayAccess.class, Expressions.BinaryExpr.class, Expressions.Call.class, Expressions.Const.class, Expressions.Misc.class, Expressions.SimpleName.class, Expressions.Super.class, Expressions.Throw.class, Expressions.UnaryExpr.class})
|
||||
public static class Expressions extends AbstractJetPsiMatcherTest {
|
||||
public void testAllFilesPresentInExpressions() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/jetPsiMatcher/expressions"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/jetPsiMatcher/expressions/arrayAccess")
|
||||
public static class ArrayAccess extends AbstractJetPsiMatcherTest {
|
||||
public void testAllFilesPresentInArrayAccess() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/jetPsiMatcher/expressions/arrayAccess"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("arrayAccess1.kt")
|
||||
public void testArrayAccess1() throws Exception {
|
||||
doTestExpressions("idea/testData/jetPsiMatcher/expressions/arrayAccess/arrayAccess1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("arrayAccess2.kt")
|
||||
public void testArrayAccess2() throws Exception {
|
||||
doTestExpressions("idea/testData/jetPsiMatcher/expressions/arrayAccess/arrayAccess2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("_arrayAccess1.kt")
|
||||
public void test_arrayAccess1() throws Exception {
|
||||
doTestExpressions("idea/testData/jetPsiMatcher/expressions/arrayAccess/_arrayAccess1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("_arrayAccess2.kt")
|
||||
public void test_arrayAccess2() throws Exception {
|
||||
doTestExpressions("idea/testData/jetPsiMatcher/expressions/arrayAccess/_arrayAccess2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("_arrayAccess3.kt")
|
||||
public void test_arrayAccess3() throws Exception {
|
||||
doTestExpressions("idea/testData/jetPsiMatcher/expressions/arrayAccess/_arrayAccess3.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/jetPsiMatcher/expressions/binaryExpr")
|
||||
public static class BinaryExpr extends AbstractJetPsiMatcherTest {
|
||||
public void testAllFilesPresentInBinaryExpr() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/jetPsiMatcher/expressions/binaryExpr"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("binaryExpr1.kt")
|
||||
public void testBinaryExpr1() throws Exception {
|
||||
doTestExpressions("idea/testData/jetPsiMatcher/expressions/binaryExpr/binaryExpr1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("binaryExpr2.kt")
|
||||
public void testBinaryExpr2() throws Exception {
|
||||
doTestExpressions("idea/testData/jetPsiMatcher/expressions/binaryExpr/binaryExpr2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("binaryExpr3.kt")
|
||||
public void testBinaryExpr3() throws Exception {
|
||||
doTestExpressions("idea/testData/jetPsiMatcher/expressions/binaryExpr/binaryExpr3.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("binaryExpr4.kt")
|
||||
public void testBinaryExpr4() throws Exception {
|
||||
doTestExpressions("idea/testData/jetPsiMatcher/expressions/binaryExpr/binaryExpr4.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("binaryExpr5.kt")
|
||||
public void testBinaryExpr5() throws Exception {
|
||||
doTestExpressions("idea/testData/jetPsiMatcher/expressions/binaryExpr/binaryExpr5.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("_binaryExpr1.kt")
|
||||
public void test_binaryExpr1() throws Exception {
|
||||
doTestExpressions("idea/testData/jetPsiMatcher/expressions/binaryExpr/_binaryExpr1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("_binaryExpr2.kt")
|
||||
public void test_binaryExpr2() throws Exception {
|
||||
doTestExpressions("idea/testData/jetPsiMatcher/expressions/binaryExpr/_binaryExpr2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("_binaryExpr3.kt")
|
||||
public void test_binaryExpr3() throws Exception {
|
||||
doTestExpressions("idea/testData/jetPsiMatcher/expressions/binaryExpr/_binaryExpr3.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("_binaryExpr4.kt")
|
||||
public void test_binaryExpr4() throws Exception {
|
||||
doTestExpressions("idea/testData/jetPsiMatcher/expressions/binaryExpr/_binaryExpr4.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("_binaryExpr5.kt")
|
||||
public void test_binaryExpr5() throws Exception {
|
||||
doTestExpressions("idea/testData/jetPsiMatcher/expressions/binaryExpr/_binaryExpr5.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("_binaryExpr6.kt")
|
||||
public void test_binaryExpr6() throws Exception {
|
||||
doTestExpressions("idea/testData/jetPsiMatcher/expressions/binaryExpr/_binaryExpr6.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/jetPsiMatcher/expressions/call")
|
||||
public static class Call extends AbstractJetPsiMatcherTest {
|
||||
public void testAllFilesPresentInCall() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/jetPsiMatcher/expressions/call"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("call1.kt")
|
||||
public void testCall1() throws Exception {
|
||||
doTestExpressions("idea/testData/jetPsiMatcher/expressions/call/call1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("call2.kt")
|
||||
public void testCall2() throws Exception {
|
||||
doTestExpressions("idea/testData/jetPsiMatcher/expressions/call/call2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("call3.kt")
|
||||
public void testCall3() throws Exception {
|
||||
doTestExpressions("idea/testData/jetPsiMatcher/expressions/call/call3.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("call4.kt")
|
||||
public void testCall4() throws Exception {
|
||||
doTestExpressions("idea/testData/jetPsiMatcher/expressions/call/call4.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("_call1.kt")
|
||||
public void test_call1() throws Exception {
|
||||
doTestExpressions("idea/testData/jetPsiMatcher/expressions/call/_call1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("_call2.kt")
|
||||
public void test_call2() throws Exception {
|
||||
doTestExpressions("idea/testData/jetPsiMatcher/expressions/call/_call2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("_call3.kt")
|
||||
public void test_call3() throws Exception {
|
||||
doTestExpressions("idea/testData/jetPsiMatcher/expressions/call/_call3.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("_call4.kt")
|
||||
public void test_call4() throws Exception {
|
||||
doTestExpressions("idea/testData/jetPsiMatcher/expressions/call/_call4.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/jetPsiMatcher/expressions/const")
|
||||
public static class Const extends AbstractJetPsiMatcherTest {
|
||||
public void testAllFilesPresentInConst() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/jetPsiMatcher/expressions/const"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("const.kt")
|
||||
public void testConst() throws Exception {
|
||||
doTestExpressions("idea/testData/jetPsiMatcher/expressions/const/const.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("_const.kt")
|
||||
public void test_const() throws Exception {
|
||||
doTestExpressions("idea/testData/jetPsiMatcher/expressions/const/_const.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/jetPsiMatcher/expressions/misc")
|
||||
public static class Misc extends AbstractJetPsiMatcherTest {
|
||||
public void testAllFilesPresentInMisc() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/jetPsiMatcher/expressions/misc"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("misc1.kt")
|
||||
public void testMisc1() throws Exception {
|
||||
doTestExpressions("idea/testData/jetPsiMatcher/expressions/misc/misc1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("misc2.kt")
|
||||
public void testMisc2() throws Exception {
|
||||
doTestExpressions("idea/testData/jetPsiMatcher/expressions/misc/misc2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("misc3.kt")
|
||||
public void testMisc3() throws Exception {
|
||||
doTestExpressions("idea/testData/jetPsiMatcher/expressions/misc/misc3.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("_misc1.kt")
|
||||
public void test_misc1() throws Exception {
|
||||
doTestExpressions("idea/testData/jetPsiMatcher/expressions/misc/_misc1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("_misc2.kt")
|
||||
public void test_misc2() throws Exception {
|
||||
doTestExpressions("idea/testData/jetPsiMatcher/expressions/misc/_misc2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("_misc3.kt")
|
||||
public void test_misc3() throws Exception {
|
||||
doTestExpressions("idea/testData/jetPsiMatcher/expressions/misc/_misc3.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/jetPsiMatcher/expressions/simpleName")
|
||||
public static class SimpleName extends AbstractJetPsiMatcherTest {
|
||||
public void testAllFilesPresentInSimpleName() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/jetPsiMatcher/expressions/simpleName"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("simpleName.kt")
|
||||
public void testSimpleName() throws Exception {
|
||||
doTestExpressions("idea/testData/jetPsiMatcher/expressions/simpleName/simpleName.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("_simpleName.kt")
|
||||
public void test_simpleName() throws Exception {
|
||||
doTestExpressions("idea/testData/jetPsiMatcher/expressions/simpleName/_simpleName.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/jetPsiMatcher/expressions/super")
|
||||
public static class Super extends AbstractJetPsiMatcherTest {
|
||||
public void testAllFilesPresentInSuper() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/jetPsiMatcher/expressions/super"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("super1.kt")
|
||||
public void testSuper1() throws Exception {
|
||||
doTestExpressions("idea/testData/jetPsiMatcher/expressions/super/super1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("super2.kt")
|
||||
public void testSuper2() throws Exception {
|
||||
doTestExpressions("idea/testData/jetPsiMatcher/expressions/super/super2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("super3.kt")
|
||||
public void testSuper3() throws Exception {
|
||||
doTestExpressions("idea/testData/jetPsiMatcher/expressions/super/super3.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("super4.kt")
|
||||
public void testSuper4() throws Exception {
|
||||
doTestExpressions("idea/testData/jetPsiMatcher/expressions/super/super4.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("_super1.kt")
|
||||
public void test_super1() throws Exception {
|
||||
doTestExpressions("idea/testData/jetPsiMatcher/expressions/super/_super1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("_super2.kt")
|
||||
public void test_super2() throws Exception {
|
||||
doTestExpressions("idea/testData/jetPsiMatcher/expressions/super/_super2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("_super3.kt")
|
||||
public void test_super3() throws Exception {
|
||||
doTestExpressions("idea/testData/jetPsiMatcher/expressions/super/_super3.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("_super4.kt")
|
||||
public void test_super4() throws Exception {
|
||||
doTestExpressions("idea/testData/jetPsiMatcher/expressions/super/_super4.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/jetPsiMatcher/expressions/throw")
|
||||
public static class Throw extends AbstractJetPsiMatcherTest {
|
||||
public void testAllFilesPresentInThrow() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/jetPsiMatcher/expressions/throw"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("throw.kt")
|
||||
public void testThrow() throws Exception {
|
||||
doTestExpressions("idea/testData/jetPsiMatcher/expressions/throw/throw.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("_throw.kt")
|
||||
public void test_throw() throws Exception {
|
||||
doTestExpressions("idea/testData/jetPsiMatcher/expressions/throw/_throw.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/jetPsiMatcher/expressions/unaryExpr")
|
||||
public static class UnaryExpr extends AbstractJetPsiMatcherTest {
|
||||
public void testAllFilesPresentInUnaryExpr() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/jetPsiMatcher/expressions/unaryExpr"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("unaryExpr1.kt")
|
||||
public void testUnaryExpr1() throws Exception {
|
||||
doTestExpressions("idea/testData/jetPsiMatcher/expressions/unaryExpr/unaryExpr1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("unaryExpr2.kt")
|
||||
public void testUnaryExpr2() throws Exception {
|
||||
doTestExpressions("idea/testData/jetPsiMatcher/expressions/unaryExpr/unaryExpr2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("_unaryExpr1.kt")
|
||||
public void test_unaryExpr1() throws Exception {
|
||||
doTestExpressions("idea/testData/jetPsiMatcher/expressions/unaryExpr/_unaryExpr1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("_unaryExpr2.kt")
|
||||
public void test_unaryExpr2() throws Exception {
|
||||
doTestExpressions("idea/testData/jetPsiMatcher/expressions/unaryExpr/_unaryExpr2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("_unaryExpr3.kt")
|
||||
public void test_unaryExpr3() throws Exception {
|
||||
doTestExpressions("idea/testData/jetPsiMatcher/expressions/unaryExpr/_unaryExpr3.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static Test innerSuite() {
|
||||
TestSuite suite = new TestSuite("Expressions");
|
||||
suite.addTestSuite(Expressions.class);
|
||||
suite.addTestSuite(ArrayAccess.class);
|
||||
suite.addTestSuite(BinaryExpr.class);
|
||||
suite.addTestSuite(Call.class);
|
||||
suite.addTestSuite(Const.class);
|
||||
suite.addTestSuite(Misc.class);
|
||||
suite.addTestSuite(SimpleName.class);
|
||||
suite.addTestSuite(Super.class);
|
||||
suite.addTestSuite(Throw.class);
|
||||
suite.addTestSuite(UnaryExpr.class);
|
||||
return suite;
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/jetPsiMatcher/types")
|
||||
public static class Types extends AbstractJetPsiMatcherTest {
|
||||
public void testAllFilesPresentInTypes() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/jetPsiMatcher/types"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("functional1.kt")
|
||||
public void testFunctional1() throws Exception {
|
||||
doTestTypes("idea/testData/jetPsiMatcher/types/functional1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("functional2.kt")
|
||||
public void testFunctional2() throws Exception {
|
||||
doTestTypes("idea/testData/jetPsiMatcher/types/functional2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("functional3.kt")
|
||||
public void testFunctional3() throws Exception {
|
||||
doTestTypes("idea/testData/jetPsiMatcher/types/functional3.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nullable1.kt")
|
||||
public void testNullable1() throws Exception {
|
||||
doTestTypes("idea/testData/jetPsiMatcher/types/nullable1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("user1.kt")
|
||||
public void testUser1() throws Exception {
|
||||
doTestTypes("idea/testData/jetPsiMatcher/types/user1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("user2.kt")
|
||||
public void testUser2() throws Exception {
|
||||
doTestTypes("idea/testData/jetPsiMatcher/types/user2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("_functional1.kt")
|
||||
public void test_functional1() throws Exception {
|
||||
doTestTypes("idea/testData/jetPsiMatcher/types/_functional1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("_functional2.kt")
|
||||
public void test_functional2() throws Exception {
|
||||
doTestTypes("idea/testData/jetPsiMatcher/types/_functional2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("_nullable1.kt")
|
||||
public void test_nullable1() throws Exception {
|
||||
doTestTypes("idea/testData/jetPsiMatcher/types/_nullable1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("_user1.kt")
|
||||
public void test_user1() throws Exception {
|
||||
doTestTypes("idea/testData/jetPsiMatcher/types/_user1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("_user2.kt")
|
||||
public void test_user2() throws Exception {
|
||||
doTestTypes("idea/testData/jetPsiMatcher/types/_user2.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
TestSuite suite = new TestSuite("JetPsiMatcherTest");
|
||||
suite.addTest(Expressions.innerSuite());
|
||||
suite.addTestSuite(Types.class);
|
||||
return suite;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user