Support 'when' with subject variable in JVM BE

This commit is contained in:
Dmitry Petrov
2018-06-08 12:51:33 +03:00
parent 148d03e365
commit d6894091a9
9 changed files with 225 additions and 24 deletions
@@ -21650,5 +21650,38 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/when/stringOptimization/statement.kt");
}
}
@TestMetadata("compiler/testData/codegen/box/when/whenSubjectVariable")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class WhenSubjectVariable extends AbstractBlackBoxCodegenTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
}
public void testAllFilesPresentInWhenSubjectVariable() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/when/whenSubjectVariable"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
}
@TestMetadata("captureSubjectVariable.kt")
public void testCaptureSubjectVariable() throws Exception {
runTest("compiler/testData/codegen/box/when/whenSubjectVariable/captureSubjectVariable.kt");
}
@TestMetadata("equalityWithSubjectVariable.kt")
public void testEqualityWithSubjectVariable() throws Exception {
runTest("compiler/testData/codegen/box/when/whenSubjectVariable/equalityWithSubjectVariable.kt");
}
@TestMetadata("isCheckOnSubjectVariable.kt")
public void testIsCheckOnSubjectVariable() throws Exception {
runTest("compiler/testData/codegen/box/when/whenSubjectVariable/isCheckOnSubjectVariable.kt");
}
@TestMetadata("rangeCheckOnSubjectVariable.kt")
public void testRangeCheckOnSubjectVariable() throws Exception {
runTest("compiler/testData/codegen/box/when/whenSubjectVariable/rangeCheckOnSubjectVariable.kt");
}
}
}
}