Ignore data flow info from assert calls

if assertions mode is not LEGACY.

This is done since assertions can be disabled (in both compile time and
runtime) and thus, the data flow info is not reliable anymore.
 #KT-24529: Fixed
This commit is contained in:
Ilmir Usmanov
2018-05-25 16:00:11 +03:00
parent 0cb73e55d0
commit df4dcc0f8e
9 changed files with 143 additions and 44 deletions
@@ -776,6 +776,29 @@ public class DiagnosticsTestWithStdLibGenerated extends AbstractDiagnosticsTestW
}
}
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/assert")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Assert extends AbstractDiagnosticsTestWithStdLib {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath);
}
public void testAllFilesPresentInAssert() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/assert"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("cast.kt")
public void testCast() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/assert/cast.kt");
}
@TestMetadata("safeCall.kt")
public void testSafeCall() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/assert/safeCall.kt");
}
}
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/builtins")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -776,6 +776,29 @@ public class DiagnosticsTestWithStdLibUsingJavacGenerated extends AbstractDiagno
}
}
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/assert")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Assert extends AbstractDiagnosticsTestWithStdLibUsingJavac {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath);
}
public void testAllFilesPresentInAssert() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/assert"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("cast.kt")
public void testCast() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/assert/cast.kt");
}
@TestMetadata("safeCall.kt")
public void testSafeCall() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/assert/safeCall.kt");
}
}
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/builtins")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)