Parser tests: move the contract description blocks tests to a separate folder and add a test for property accessors' contracts

This commit is contained in:
Arsen Nagdalian
2020-07-22 04:39:04 +03:00
parent 66f7250380
commit 86e07cd626
9 changed files with 377 additions and 15 deletions
@@ -380,21 +380,11 @@ public class ParsingTestGenerated extends AbstractParsingTest {
runTest("compiler/testData/psi/FunctionTypes.kt");
}
@TestMetadata("FunctionWithMultilineContract.kt")
public void testFunctionWithMultilineContract() throws Exception {
runTest("compiler/testData/psi/FunctionWithMultilineContract.kt");
}
@TestMetadata("Functions.kt")
public void testFunctions() throws Exception {
runTest("compiler/testData/psi/Functions.kt");
}
@TestMetadata("FunctionsWithTypeConstraintsAndContract.kt")
public void testFunctionsWithTypeConstraintsAndContract() throws Exception {
runTest("compiler/testData/psi/FunctionsWithTypeConstraintsAndContract.kt");
}
@TestMetadata("FunctionsWithoutName.kt")
public void testFunctionsWithoutName() throws Exception {
runTest("compiler/testData/psi/FunctionsWithoutName.kt");
@@ -630,11 +620,6 @@ public class ParsingTestGenerated extends AbstractParsingTest {
runTest("compiler/testData/psi/SimpleExpressions.kt");
}
@TestMetadata("SimpleFunctionWithContract.kt")
public void testSimpleFunctionWithContract() throws Exception {
runTest("compiler/testData/psi/SimpleFunctionWithContract.kt");
}
@TestMetadata("SimpleModifiers.kt")
public void testSimpleModifiers() throws Exception {
runTest("compiler/testData/psi/SimpleModifiers.kt");
@@ -1277,6 +1262,39 @@ public class ParsingTestGenerated extends AbstractParsingTest {
}
}
@TestMetadata("compiler/testData/psi/contracts")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Contracts extends AbstractParsingTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doParsingTest, this, testDataFilePath);
}
public void testAllFilesPresentInContracts() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/psi/contracts"), Pattern.compile("^(.*)\\.kts?$"), null, true);
}
@TestMetadata("FunctionWithMultilineContract.kt")
public void testFunctionWithMultilineContract() throws Exception {
runTest("compiler/testData/psi/contracts/FunctionWithMultilineContract.kt");
}
@TestMetadata("FunctionsWithTypeConstraintsAndContract.kt")
public void testFunctionsWithTypeConstraintsAndContract() throws Exception {
runTest("compiler/testData/psi/contracts/FunctionsWithTypeConstraintsAndContract.kt");
}
@TestMetadata("PropertyAccessorsContracts.kt")
public void testPropertyAccessorsContracts() throws Exception {
runTest("compiler/testData/psi/contracts/PropertyAccessorsContracts.kt");
}
@TestMetadata("SimpleFunctionWithContract.kt")
public void testSimpleFunctionWithContract() throws Exception {
runTest("compiler/testData/psi/contracts/SimpleFunctionWithContract.kt");
}
}
@TestMetadata("compiler/testData/psi/examples")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)