Implement Unwrap/Remove for lambdas

This commit is contained in:
Alexey Sedunov
2013-06-19 15:13:49 +04:00
parent 8964e0e152
commit 9d46c90165
23 changed files with 229 additions and 2 deletions
@@ -46,6 +46,10 @@ public abstract class AbstractUnwrapRemoveTest extends LightCodeInsightTestCase
doTest(path, KoitlinUnwrappers.KotlinLoopUnwrapper.class);
}
public void doTestLambdaUnwrapper(@NotNull String path) throws Exception {
doTest(path, KotlinLambdaUnwrapper.class);
}
private void doTest(@NotNull String path, final Class<? extends Unwrapper> unwrapperClass) throws Exception {
configureByFile(path);
@@ -30,7 +30,7 @@ import org.jetbrains.jet.plugin.codeInsight.unwrap.AbstractUnwrapRemoveTest;
/** This class is generated by {@link org.jetbrains.jet.generators.tests.GenerateTests}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@InnerTestClasses({UnwrapRemoveTestGenerated.UnwrapThen.class, UnwrapRemoveTestGenerated.UnwrapElse.class, UnwrapRemoveTestGenerated.RemoveElse.class, UnwrapRemoveTestGenerated.UnwrapLoop.class})
@InnerTestClasses({UnwrapRemoveTestGenerated.UnwrapThen.class, UnwrapRemoveTestGenerated.UnwrapElse.class, UnwrapRemoveTestGenerated.RemoveElse.class, UnwrapRemoveTestGenerated.UnwrapLoop.class, UnwrapRemoveTestGenerated.UnwrapLambda.class})
public class UnwrapRemoveTestGenerated extends AbstractUnwrapRemoveTest {
@TestMetadata("idea/testData/codeInsight/unwrapAndRemove/unwrapThen")
public static class UnwrapThen extends AbstractUnwrapRemoveTest {
@@ -114,12 +114,71 @@ public class UnwrapRemoveTestGenerated extends AbstractUnwrapRemoveTest {
}
@TestMetadata("idea/testData/codeInsight/unwrapAndRemove/unwrapLambda")
public static class UnwrapLambda extends AbstractUnwrapRemoveTest {
public void testAllFilesPresentInUnwrapLambda() throws Exception {
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/codeInsight/unwrapAndRemove/unwrapLambda"), Pattern.compile("^(.+)\\.kt$"), true);
}
@TestMetadata("lambdaCallCompoundInBlock.kt")
public void testLambdaCallCompoundInBlock() throws Exception {
doTestLambdaUnwrapper("idea/testData/codeInsight/unwrapAndRemove/unwrapLambda/lambdaCallCompoundInBlock.kt");
}
@TestMetadata("lambdaCallCompoundInReturn.kt")
public void testLambdaCallCompoundInReturn() throws Exception {
doTestLambdaUnwrapper("idea/testData/codeInsight/unwrapAndRemove/unwrapLambda/lambdaCallCompoundInReturn.kt");
}
@TestMetadata("lambdaCallInBlock.kt")
public void testLambdaCallInBlock() throws Exception {
doTestLambdaUnwrapper("idea/testData/codeInsight/unwrapAndRemove/unwrapLambda/lambdaCallInBlock.kt");
}
@TestMetadata("lambdaCallInBlock2.kt")
public void testLambdaCallInBlock2() throws Exception {
doTestLambdaUnwrapper("idea/testData/codeInsight/unwrapAndRemove/unwrapLambda/lambdaCallInBlock2.kt");
}
@TestMetadata("lambdaCallSimpleInReturn.kt")
public void testLambdaCallSimpleInReturn() throws Exception {
doTestLambdaUnwrapper("idea/testData/codeInsight/unwrapAndRemove/unwrapLambda/lambdaCallSimpleInReturn.kt");
}
@TestMetadata("lambdaInBlock.kt")
public void testLambdaInBlock() throws Exception {
doTestLambdaUnwrapper("idea/testData/codeInsight/unwrapAndRemove/unwrapLambda/lambdaInBlock.kt");
}
@TestMetadata("lambdaNonLocalPropertyCompoundInBlock.kt")
public void testLambdaNonLocalPropertyCompoundInBlock() throws Exception {
doTestLambdaUnwrapper("idea/testData/codeInsight/unwrapAndRemove/unwrapLambda/lambdaNonLocalPropertyCompoundInBlock.kt");
}
@TestMetadata("lambdaNonLocalPropertyInBlock.kt")
public void testLambdaNonLocalPropertyInBlock() throws Exception {
doTestLambdaUnwrapper("idea/testData/codeInsight/unwrapAndRemove/unwrapLambda/lambdaNonLocalPropertyInBlock.kt");
}
@TestMetadata("lambdaPropertyCompoundInBlock.kt")
public void testLambdaPropertyCompoundInBlock() throws Exception {
doTestLambdaUnwrapper("idea/testData/codeInsight/unwrapAndRemove/unwrapLambda/lambdaPropertyCompoundInBlock.kt");
}
@TestMetadata("lambdaPropertyInBlock.kt")
public void testLambdaPropertyInBlock() throws Exception {
doTestLambdaUnwrapper("idea/testData/codeInsight/unwrapAndRemove/unwrapLambda/lambdaPropertyInBlock.kt");
}
}
public static Test suite() {
TestSuite suite = new TestSuite("UnwrapRemoveTestGenerated");
suite.addTestSuite(UnwrapThen.class);
suite.addTestSuite(UnwrapElse.class);
suite.addTestSuite(RemoveElse.class);
suite.addTestSuite(UnwrapLoop.class);
suite.addTestSuite(UnwrapLambda.class);
return suite;
}
}