Add boolean literals diagnostic spec tests

This commit is contained in:
victor.petukhov
2018-10-31 13:07:22 +03:00
parent 1af1eed31c
commit 73ecde6cc3
7 changed files with 142 additions and 0 deletions
@@ -0,0 +1,24 @@
// !CHECK_TYPE
/*
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
*
* SECTIONS: constant-literals, boolean-literals
* PARAGRAPH: 1
* SENTENCE: [3] These are strong keywords which cannot be used as identifiers unless [escaped][Escaped identifiers].
* NUMBER: 1
* DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the class.
* NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY
*/
// TESTCASE NUMBER: 1
fun case_1() {
true checkType { <!TYPE_MISMATCH!>_<!><Boolean?>() }
false checkType { <!TYPE_MISMATCH!>_<!><Boolean?>() }
true checkType { <!TYPE_MISMATCH!>_<!><Any?>() }
false checkType { <!TYPE_MISMATCH!>_<!><Any>() }
true checkType { <!TYPE_MISMATCH!>_<!><Nothing?>() }
false checkType { <!TYPE_MISMATCH!>_<!><Nothing>() }
}
@@ -0,0 +1,3 @@
package
public fun case_1(): kotlin.Unit
@@ -0,0 +1,21 @@
// !CHECK_TYPE
/*
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
*
* SECTIONS: constant-literals, boolean-literals
* PARAGRAPH: 1
* SENTENCE: [3] These are strong keywords which cannot be used as identifiers unless [escaped][Escaped identifiers].
* NUMBER: 1
* DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the class.
* NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY
*/
// TESTCASE NUMBER: 1
fun case_1() {
true checkType { _<Boolean>() }
false checkType { _<Boolean>() }
checkSubtype<Boolean>(true)
checkSubtype<Boolean>(false)
}
@@ -0,0 +1,3 @@
package
public fun case_1(): kotlin.Unit
@@ -0,0 +1,21 @@
// !CHECK_TYPE
/*
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
*
* SECTIONS: constant-literals, boolean-literals
* PARAGRAPH: 1
* SENTENCE: [3] These are strong keywords which cannot be used as identifiers unless [escaped][Escaped identifiers].
* NUMBER: 2
* DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the class.
* NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY
*/
// TESTCASE NUMBER: 1
fun case_1() {
checkSubtype<Boolean?>(true)
checkSubtype<Boolean?>(false)
checkSubtype<Any>(true)
checkSubtype<Any>(false)
}
@@ -0,0 +1,3 @@
package
public fun case_1(): kotlin.Unit
@@ -53,6 +53,73 @@ public class DiagnosticsTestSpecGenerated extends AbstractDiagnosticsTestSpec {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/constant-literals"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("compiler/tests-spec/testData/diagnostics/linked/constant-literals/boolean-literals")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Boolean_literals extends AbstractDiagnosticsTestSpec {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath);
}
public void testAllFilesPresentInBoolean_literals() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/constant-literals/boolean-literals"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("compiler/tests-spec/testData/diagnostics/linked/constant-literals/boolean-literals/p-1")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class P_1 extends AbstractDiagnosticsTestSpec {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath);
}
public void testAllFilesPresentInP_1() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/constant-literals/boolean-literals/p-1"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("compiler/tests-spec/testData/diagnostics/linked/constant-literals/boolean-literals/p-1/neg")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Neg extends AbstractDiagnosticsTestSpec {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath);
}
@TestMetadata("3.1.kt")
public void test3_1() throws Exception {
runTest("compiler/tests-spec/testData/diagnostics/linked/constant-literals/boolean-literals/p-1/neg/3.1.kt");
}
public void testAllFilesPresentInNeg() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/constant-literals/boolean-literals/p-1/neg"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
}
}
@TestMetadata("compiler/tests-spec/testData/diagnostics/linked/constant-literals/boolean-literals/p-1/pos")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Pos extends AbstractDiagnosticsTestSpec {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath);
}
@TestMetadata("3.1.kt")
public void test3_1() throws Exception {
runTest("compiler/tests-spec/testData/diagnostics/linked/constant-literals/boolean-literals/p-1/pos/3.1.kt");
}
@TestMetadata("3.2.kt")
public void test3_2() throws Exception {
runTest("compiler/tests-spec/testData/diagnostics/linked/constant-literals/boolean-literals/p-1/pos/3.2.kt");
}
public void testAllFilesPresentInPos() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/constant-literals/boolean-literals/p-1/pos"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
}
}
}
}
@TestMetadata("compiler/tests-spec/testData/diagnostics/linked/constant-literals/integer-literals")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)