Inspection: Simplify Nested forEach/onEach in also/apply to onEach

^KT-40283 Fixed
This commit is contained in:
Enteerman
2020-07-21 20:50:07 +08:00
committed by Vladimir Dolzhenko
parent 85d99612a2
commit c3aeaa9052
25 changed files with 423 additions and 0 deletions
@@ -13084,6 +13084,84 @@ public class LocalInspectionTestGenerated extends AbstractLocalInspectionTest {
}
}
@TestMetadata("idea/testData/inspectionsLocal/simplifyNestedEachInScope")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class SimplifyNestedEachInScope extends AbstractLocalInspectionTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInSimplifyNestedEachInScope() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/testData/inspectionsLocal/simplifyNestedEachInScope"), Pattern.compile("^([\\w\\-_]+)\\.(kt|kts)$"), null, true);
}
@TestMetadata("also.kt")
public void testAlso() throws Exception {
runTest("idea/testData/inspectionsLocal/simplifyNestedEachInScope/also.kt");
}
@TestMetadata("also2.kt")
public void testAlso2() throws Exception {
runTest("idea/testData/inspectionsLocal/simplifyNestedEachInScope/also2.kt");
}
@TestMetadata("also3.kt")
public void testAlso3() throws Exception {
runTest("idea/testData/inspectionsLocal/simplifyNestedEachInScope/also3.kt");
}
@TestMetadata("also4.kt")
public void testAlso4() throws Exception {
runTest("idea/testData/inspectionsLocal/simplifyNestedEachInScope/also4.kt");
}
@TestMetadata("also5.kt")
public void testAlso5() throws Exception {
runTest("idea/testData/inspectionsLocal/simplifyNestedEachInScope/also5.kt");
}
@TestMetadata("alsoLabel.kt")
public void testAlsoLabel() throws Exception {
runTest("idea/testData/inspectionsLocal/simplifyNestedEachInScope/alsoLabel.kt");
}
@TestMetadata("alsoLabel2.kt")
public void testAlsoLabel2() throws Exception {
runTest("idea/testData/inspectionsLocal/simplifyNestedEachInScope/alsoLabel2.kt");
}
@TestMetadata("alsoLabel3.kt")
public void testAlsoLabel3() throws Exception {
runTest("idea/testData/inspectionsLocal/simplifyNestedEachInScope/alsoLabel3.kt");
}
@TestMetadata("apply.kt")
public void testApply() throws Exception {
runTest("idea/testData/inspectionsLocal/simplifyNestedEachInScope/apply.kt");
}
@TestMetadata("apply2.kt")
public void testApply2() throws Exception {
runTest("idea/testData/inspectionsLocal/simplifyNestedEachInScope/apply2.kt");
}
@TestMetadata("apply3.kt")
public void testApply3() throws Exception {
runTest("idea/testData/inspectionsLocal/simplifyNestedEachInScope/apply3.kt");
}
@TestMetadata("applyLabel.kt")
public void testApplyLabel() throws Exception {
runTest("idea/testData/inspectionsLocal/simplifyNestedEachInScope/applyLabel.kt");
}
@TestMetadata("applyLabel2.kt")
public void testApplyLabel2() throws Exception {
runTest("idea/testData/inspectionsLocal/simplifyNestedEachInScope/applyLabel2.kt");
}
}
@TestMetadata("idea/testData/inspectionsLocal/simplifyWhenWithBooleanConstantCondition")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)