Supported inlining constant properties.

This commit is contained in:
Evgeny Gerashchenko
2013-07-24 14:15:11 +04:00
parent b721b0211a
commit a13092e525
17 changed files with 205 additions and 40 deletions
@@ -28,7 +28,7 @@ public abstract class AbstractInlineTest extends LightCodeInsightFixtureTestCase
final PsiElement targetElement =
TargetElementUtilBase.findTargetElement(myFixture.getEditor(), ELEMENT_NAME_ACCEPTED | REFERENCED_ELEMENT_ACCEPTED);
final KotlinInlineLocalHandler handler = new KotlinInlineLocalHandler();
final KotlinInlineValHandler handler = new KotlinInlineValHandler();
List<String> expectedErrors = InTextDirectivesUtils.findLinesWithPrefixesRemoved(myFixture.getFile().getText(), "// ERROR: ");
if (handler.canInlineElement(targetElement)) {
@@ -31,7 +31,7 @@ import org.jetbrains.jet.plugin.refactoring.inline.AbstractInlineTest;
/** This class is generated by {@link org.jetbrains.jet.generators.tests.GenerateTests}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@TestMetadata("idea/testData/refactoring/inline")
@InnerTestClasses({InlineTestGenerated.AddParenthesis.class, InlineTestGenerated.ExplicateParameterTypes.class, InlineTestGenerated.ExplicateTypeArgument.class})
@InnerTestClasses({InlineTestGenerated.AddParenthesis.class, InlineTestGenerated.ExplicateParameterTypes.class, InlineTestGenerated.ExplicateTypeArgument.class, InlineTestGenerated.Property.class})
public class InlineTestGenerated extends AbstractInlineTest {
public void testAllFilesPresentInInline() throws Exception {
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/refactoring/inline"), Pattern.compile("^(.+)\\.kt$"), true);
@@ -232,11 +232,6 @@ public class InlineTestGenerated extends AbstractInlineTest {
public void testQualifiedDontAdd() throws Exception {
doTest("idea/testData/refactoring/inline/addParenthesis/QualifiedDontAdd.kt");
}
@TestMetadata("UnaryIntoBinary.kt")
public void testUnaryIntoBinary() throws Exception {
doTest("idea/testData/refactoring/inline/addParenthesis/UnaryIntoBinary.kt");
}
@TestMetadata("StringTemplate.kt")
public void testStringTemplate() throws Exception {
@@ -253,6 +248,11 @@ public class InlineTestGenerated extends AbstractInlineTest {
doTest("idea/testData/refactoring/inline/addParenthesis/StringTemplateDontAdd.kt");
}
@TestMetadata("UnaryIntoBinary.kt")
public void testUnaryIntoBinary() throws Exception {
doTest("idea/testData/refactoring/inline/addParenthesis/UnaryIntoBinary.kt");
}
}
@TestMetadata("idea/testData/refactoring/inline/explicateParameterTypes")
@@ -351,12 +351,61 @@ public class InlineTestGenerated extends AbstractInlineTest {
}
@TestMetadata("idea/testData/refactoring/inline/property")
public static class Property extends AbstractInlineTest {
public void testAllFilesPresentInProperty() throws Exception {
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/refactoring/inline/property"), Pattern.compile("^(.+)\\.kt$"), true);
}
@TestMetadata("Basic.kt")
public void testBasic() throws Exception {
doTest("idea/testData/refactoring/inline/property/Basic.kt");
}
@TestMetadata("ClassObjectProperty.kt")
public void testClassObjectProperty() throws Exception {
doTest("idea/testData/refactoring/inline/property/ClassObjectProperty.kt");
}
@TestMetadata("ExtensionProperty.kt")
public void testExtensionProperty() throws Exception {
doTest("idea/testData/refactoring/inline/property/ExtensionProperty.kt");
}
@TestMetadata("InstanceProperty.kt")
public void testInstanceProperty() throws Exception {
doTest("idea/testData/refactoring/inline/property/InstanceProperty.kt");
}
@TestMetadata("ObjectProperty.kt")
public void testObjectProperty() throws Exception {
doTest("idea/testData/refactoring/inline/property/ObjectProperty.kt");
}
@TestMetadata("QualifiedUsage.kt")
public void testQualifiedUsage() throws Exception {
doTest("idea/testData/refactoring/inline/property/QualifiedUsage.kt");
}
@TestMetadata("WithGetter.kt")
public void testWithGetter() throws Exception {
doTest("idea/testData/refactoring/inline/property/WithGetter.kt");
}
@TestMetadata("WithInitializerAndGetter.kt")
public void testWithInitializerAndGetter() throws Exception {
doTest("idea/testData/refactoring/inline/property/WithInitializerAndGetter.kt");
}
}
public static Test suite() {
TestSuite suite = new TestSuite("InlineTestGenerated");
suite.addTestSuite(InlineTestGenerated.class);
suite.addTestSuite(AddParenthesis.class);
suite.addTestSuite(ExplicateParameterTypes.class);
suite.addTestSuite(ExplicateTypeArgument.class);
suite.addTestSuite(Property.class);
return suite;
}
}