[Spec tests] Add tests for when-expression (p-3, 4)

This commit is contained in:
anastasiia.spaseeva
2019-12-18 13:54:24 +03:00
parent bd979a12de
commit dcfcc9c7b6
22 changed files with 843 additions and 4 deletions
@@ -0,0 +1 @@
java.lang.IllegalStateException: NO_ELSE_IN_WHEN: 'when' expression must be exhaustive, add necessary 'Val_1', 'Val_2' branches or 'else' branch instead (4,17) in /KotlinClass.kt
@@ -0,0 +1,29 @@
// WITH_RUNTIME
// FULL_JDK
/*
* KOTLIN CODEGEN BOX SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 0.1-218
* PLACE: expressions, when-expression -> paragraph 4 -> sentence 1
* NUMBER: 1
* DESCRIPTION: it is possible to replace the else condition with an always-true condition (Enum)
* EXCEPTION: compiletime
*/
// FILE: JavaEnum.java
enum JavaEnum {
Val_1,
Val_2,
Val_3,
}
// FILE: KotlinClass.kt
fun box(): String {
val z = JavaEnum.Val_3
val when3 = when (z) {
JavaEnum.Val_3 -> { "OK" }
}
return when3
}
@@ -0,0 +1 @@
java.lang.IllegalStateException: NO_ELSE_IN_WHEN: 'when' expression must be exhaustive, add necessary 'false' branch or 'else' branch instead (15,17) in /1.2.kt
@@ -0,0 +1,19 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 0.1-218
* PLACE: expressions, when-expression -> paragraph 4 -> sentence 1
* NUMBER: 2
* DESCRIPTION: it is possible to replace the else condition with an always-true condition (Boolean)
* EXCEPTION: compiletime
*/
fun box(): String {
val b = true
val when2 = when (b) {
!false -> { "OK" }
}
return when2
}
@@ -0,0 +1 @@
java.lang.IllegalStateException: NO_ELSE_IN_WHEN: 'when' expression must be exhaustive, add necessary 'true' branch or 'else' branch instead (15,17) in /1.3.kt
@@ -0,0 +1,20 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 0.1-218
* PLACE: expressions, when-expression -> paragraph 4 -> sentence 1
* NUMBER: 3
* DESCRIPTION: it is possible to replace the else condition with an always-true condition (Boolean)
* EXCEPTION: compiletime
*/
fun box(): String {
val a = false
val when2 = when (a) {
false -> { "OK" }
false -> { "NOK" }
}
return when2
}
@@ -0,0 +1 @@
java.lang.IllegalStateException: NO_ELSE_IN_WHEN: 'when' expression must be exhaustive, add necessary 'is C' branch or 'else' branch instead (22,17) in /1.4.kt
@@ -0,0 +1,28 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 0.1-218
* PLACE: expressions, when-expression -> paragraph 4 -> sentence 1
* NUMBER: 4
* DESCRIPTION: it is possible to replace the else condition with an always-true condition (sealed class)
* EXCEPTION: compiletime
*/
sealed class SClass {
class A : SClass()
class B : SClass()
class C : SClass()
}
fun box(): String {
val x: SClass = SClass.B()
val when1 = when (x){
is SClass.A ->{ "NOK"}
is SClass.B ->{ "OK" }
is SClass.B ->{ "NOK" }
}
return when1
}
@@ -0,0 +1,31 @@
// WITH_RUNTIME
// FULL_JDK
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-218
* PLACE: expressions, when-expression -> paragraph 4 -> sentence 1
* NUMBER: 1
* DESCRIPTION: it is possible to replace the else condition with an always-true condition (Enum)
*/
// FILE: JavaEnum.java
enum JavaEnum {
Val_1,
Val_2,
Val_3,
}
// FILE: KotlinClass.kt
fun box(): String {
val z = JavaEnum.Val_3
val when3 = when (z) {
JavaEnum.Val_1 -> { "NOK" }
JavaEnum.Val_3 -> { "OK" }
JavaEnum.Val_3 -> { "NOK" }
JavaEnum.Val_2 -> { "NOK" }
}
return when3
}
@@ -0,0 +1,20 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-218
* PLACE: expressions, when-expression -> paragraph 4 -> sentence 1
* NUMBER: 2
* DESCRIPTION: it is possible to replace the else condition with an always-true condition (Boolean)
*/
fun box(): String {
val b = true
val when2 = when (b) {
false -> { "NOK" }
!false -> { "OK" }
!false -> { "NOK" }
}
return when2
}
@@ -0,0 +1,20 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-218
* PLACE: expressions, when-expression -> paragraph 4 -> sentence 1
* NUMBER: 3
* DESCRIPTION: it is possible to replace the else condition with an always-true condition (Boolean)
*/
fun box(): String {
val a = false
val when2 = when (a) {
true -> { "NOK" }
false -> { "OK" }
false -> { "NOK" }
}
return when2
}
@@ -0,0 +1,28 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-218
* PLACE: expressions, when-expression -> paragraph 4 -> sentence 1
* NUMBER: 4
* DESCRIPTION: it is possible to replace the else condition with an always-true condition (sealed class)
*/
sealed class SClass {
class A : SClass()
class B : SClass()
class C : SClass()
}
fun box(): String {
val x: SClass = SClass.B()
val when1 = when (x){
is SClass.A ->{ "NOK"}
is SClass.B ->{ "OK" }
is SClass.B ->{ "NOK" }
is SClass.C ->{ "NOK" }
}
return when1
}
@@ -0,0 +1 @@
java.lang.IllegalStateException: ELSE_MISPLACED_IN_WHEN: 'else' entry must be the last one in a when-expression (6,9) in /KotlinClass.kt
@@ -0,0 +1,32 @@
// WITH_RUNTIME
// FULL_JDK
/*
* KOTLIN CODEGEN BOX SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 0.1-218
* PLACE: expressions, when-expression -> paragraph 5 -> sentence 2
* NUMBER: 1
* DESCRIPTION: The else condition is a special condition which evaluates to true if none of the branches above it evaluated to true.
* EXCEPTION: compiletime
*/
// FILE: JavaEnum.java
enum JavaEnum {
Val_1,
Val_2,
Val_3,
}
// FILE: KotlinClass.kt
fun box(): String {
val z = JavaEnum.Val_3
val when1 = when (z) {
JavaEnum.Val_1 -> { false }
else -> {true}
JavaEnum.Val_2 -> { false }
}
return "NOK"
}
@@ -0,0 +1,33 @@
// WITH_RUNTIME
// FULL_JDK
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-218
* PLACE: expressions, when-expression -> paragraph 5 -> sentence 1
* NUMBER: 1
* DESCRIPTION: The else condition must also be in the last when entry of when expression, otherwise it is a compile-time error.
*/
// FILE: JavaEnum.java
enum JavaEnum {
Val_1,
Val_2,
Val_3,
}
// FILE: KotlinClass.kt
fun box(): String {
val z = JavaEnum.Val_3
val when1 = when (z) {
JavaEnum.Val_1 -> { false }
else -> {true}
}
val when2 = when (z) {
JavaEnum.Val_3 -> { true }
else -> {false}
}
return if (when1 && when2) "OK" else "NOK"
}
@@ -0,0 +1,82 @@
{
"4": {
"neg": {
"1": [
{
"specVersion": "0.1-218",
"casesNumber": 0,
"description": " it is possible to replace the else condition with an always-true condition (Boolean)",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-218",
"casesNumber": 0,
"description": " it is possible to replace the else condition with an always-true condition (Boolean)",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-218",
"casesNumber": 0,
"description": " it is possible to replace the else condition with an always-true condition (sealed class)",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-218",
"casesNumber": 0,
"description": "it is possible to replace the else condition with an always-true condition (Enum)",
"unexpectedBehaviour": false
}
]
},
"pos": {
"1": [
{
"specVersion": "0.1-218",
"casesNumber": 0,
"description": " it is possible to replace the else condition with an always-true condition (Boolean)",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-218",
"casesNumber": 0,
"description": " it is possible to replace the else condition with an always-true condition (Boolean)",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-218",
"casesNumber": 0,
"description": " it is possible to replace the else condition with an always-true condition (sealed class)",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-218",
"casesNumber": 0,
"description": "it is possible to replace the else condition with an always-true condition (Enum)",
"unexpectedBehaviour": false
}
]
}
},
"5": {
"neg": {
"2": [
{
"specVersion": "0.1-218",
"casesNumber": 0,
"description": "The else condition is a special condition which evaluates to true if none of the branches above it evaluated to true.",
"unexpectedBehaviour": false
}
]
},
"pos": {
"1": [
{
"specVersion": "0.1-218",
"casesNumber": 0,
"description": "The else condition must also be in the last when entry of when expression, otherwise it is a compile-time error.",
"unexpectedBehaviour": false
}
]
}
}
}
@@ -0,0 +1,54 @@
// !LANGUAGE: +NewInference
// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION
// SKIP_TXT
/*
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 0.1-218
* PLACE: expressions, when-expression -> paragraph 3 -> sentence 2
* NUMBER: 1
* DESCRIPTION: The else condition must also be in the last when entry of when expression, otherwise it is a compile-time error
*/
// FILE: JavaEnum.java
enum JavaEnum {
Val_1,
Val_2,
Val_3,
}
// FILE: KotlinClass.kt
// TESTCASE NUMBER: 1
fun case1() {
val z = JavaEnum.Val_3
val when1 = when (z) {
JavaEnum.Val_1 -> { false }
<!ELSE_MISPLACED_IN_WHEN!>else<!> -> {true}
<!UNREACHABLE_CODE!>JavaEnum.Val_2 -> { false }<!>
}
}
// TESTCASE NUMBER: 2
fun case2() {
val z = JavaEnum.Val_3
val when1 = when (z) {
<!ELSE_MISPLACED_IN_WHEN!>else<!> -> {true}
<!UNREACHABLE_CODE!>JavaEnum.Val_1 -> { false }<!>
<!UNREACHABLE_CODE!>JavaEnum.Val_2 -> { false }<!>
}
}// TESTCASE NUMBER: 3
fun case3() {
val z = JavaEnum.Val_3
val when1 = when (z) {
<!ELSE_MISPLACED_IN_WHEN!>else<!> -> {true}
<!UNREACHABLE_CODE!>JavaEnum.Val_1 -> { false }<!>
<!UNREACHABLE_CODE!>JavaEnum.Val_2 -> { false }<!>
<!UNREACHABLE_CODE!>else -> { true }<!>
}
}
@@ -0,0 +1,69 @@
// !LANGUAGE: +NewInference
// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION
// SKIP_TXT
// FULL_JDK
/*
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 0.1-218
* PLACE: expressions, when-expression -> paragraph 4 -> sentence 1
* NUMBER: 1
* DESCRIPTION: it is possible to replace the else condition with an always-true condition
*/
// FILE: JavaEnum.java
enum JavaEnum {
Val_1,
Val_2,
}
// FILE: KotlinClass.kt
// TESTCASE NUMBER: 1
fun case1() {
val z = JavaEnum.Val_1
val when2 = <!NO_ELSE_IN_WHEN!>when<!> (z) {
JavaEnum.Val_1 -> { }
<!DUPLICATE_LABEL_IN_WHEN!>JavaEnum.Val_1<!> -> { }
}
}
// TESTCASE NUMBER: 2
fun case2() {
val b = false
val when2: Any = <!NO_ELSE_IN_WHEN!>when<!> (b) {
false -> { }
<!DUPLICATE_LABEL_IN_WHEN!>false<!> -> { }
}
}
// TESTCASE NUMBER: 3
fun case3() {
val a = false
val when2: Any = <!NO_ELSE_IN_WHEN!>when<!> (a) {
true -> { }
<!DUPLICATE_LABEL_IN_WHEN!>true<!> -> { }
}
}
// TESTCASE NUMBER: 4
fun case4() {
val x: SClass = SClass.B()
val when2 = <!NO_ELSE_IN_WHEN!>when<!> (x){
is SClass.A ->{ }
is SClass.B ->{ }
is <!DUPLICATE_LABEL_IN_WHEN!>SClass.B<!> ->{ }
}
}
sealed class SClass {
class A : SClass()
class B : SClass()
class C : SClass()
}
@@ -0,0 +1,114 @@
// !LANGUAGE: +NewInference
// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION
// SKIP_TXT
// FULL_JDK
/*
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-218
* PLACE: expressions, when-expression -> paragraph 4 -> sentence 1
* NUMBER: 1
* DESCRIPTION: it is possible to replace the else condition with an always-true condition
*/
// FILE: JavaEnum.java
enum JavaEnum {
Val_1,
Val_2,
}
// FILE: KotlinClass.kt
// TESTCASE NUMBER: 1
fun case1() {
val z = JavaEnum.Val_1
val when1 = when (z) {
JavaEnum.Val_1 -> { }
JavaEnum.Val_2 -> { }
<!REDUNDANT_ELSE_IN_WHEN!>else<!> -> {}
}
val when2 = when (z) {
JavaEnum.Val_1 -> { }
JavaEnum.Val_2 -> { }
}
val when3 = when (z) {
JavaEnum.Val_1 -> { }
JavaEnum.Val_2 -> { }
<!DUPLICATE_LABEL_IN_WHEN!>JavaEnum.Val_2<!> -> { }
}
}
// TESTCASE NUMBER: 2
fun case2() {
val b = false
val when1: Any = when (b) {
false -> { }
!false -> { }
<!REDUNDANT_ELSE_IN_WHEN!>else<!> -> { }
}
val when2: Any = when (b) {
false -> { }
!false -> { }
}
val when3: Any = when (b) {
false -> { }
<!DUPLICATE_LABEL_IN_WHEN!>false<!> -> { }
!false -> { }
}
}
// TESTCASE NUMBER: 3
fun case3() {
val a = false
val when1: Any = when (a) {
true -> { }
false -> { }
<!REDUNDANT_ELSE_IN_WHEN!>else<!> -> { }
}
val when2: Any = when (a) {
true -> { }
false -> { }
}
val when3: Any = when (a) {
true -> { }
false -> { }
<!DUPLICATE_LABEL_IN_WHEN!>false<!> -> { }
}
}
// TESTCASE NUMBER: 4
fun case4() {
val x: SClass = SClass.B()
val when1 = when (x){
is SClass.A ->{ }
is SClass.B ->{ }
is SClass.C ->{ }
<!REDUNDANT_ELSE_IN_WHEN!>else<!> -> { }
}
val when2 = when (x){
is SClass.A ->{ }
is SClass.B ->{ }
is SClass.C ->{ }
}
val when3 = when (x){
is SClass.A ->{ }
is SClass.B ->{ }
is <!DUPLICATE_LABEL_IN_WHEN!>SClass.B<!> ->{ }
is SClass.C ->{ }
}
}
sealed class SClass {
class A : SClass()
class B : SClass()
class C : SClass()
}
@@ -151,6 +151,40 @@
] ]
} }
}, },
"4": {
"neg": {
"1": [
{
"specVersion": "0.1-218",
"casesNumber": 4,
"description": " it is possible to replace the else condition with an always-true condition",
"unexpectedBehaviour": false
}
]
},
"pos": {
"1": [
{
"specVersion": "0.1-218",
"casesNumber": 4,
"description": " it is possible to replace the else condition with an always-true condition",
"unexpectedBehaviour": false
}
]
}
},
"3": {
"neg": {
"2": [
{
"specVersion": "0.1-218",
"casesNumber": 2,
"description": "The else condition must also be in the last when entry of when expression, otherwise it is a compile-time error",
"unexpectedBehaviour": false
}
]
}
},
"2": { "2": {
"neg": { "neg": {
"2": [ "2": [
@@ -25,7 +25,7 @@ public class DiagnosticsTestSpecGenerated extends AbstractDiagnosticsTestSpec {
} }
public void testAllFilesPresentInDiagnostics() throws Exception { public void testAllFilesPresentInDiagnostics() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics"), Pattern.compile("^(.+)\\.kt$"), true, "helpers", "linked/type-inference", "linked/type-system/type-kinds/type-parameters", "linked/type-system/subtyping", "linked/control--and-data-flow-analysis.control-flow-graph.expressions-1.conditional-expressions", "linked/declarations/classifier-declaration/classifier-initialization", "linked/declarations/function-declaration", "linked/annotations", "linked/statements", "linked/inheritance", "linked/expressions.conditional-expression", "linked/expressions/function-literals", "linked/expressions/built-in-types-and-their-semantics/kotlin.nothing-1/p-1/neg", "linked/overload-resolution", "linked/control--and-data-flow-analysis/performing-analysis-on-the-control-flow-graph"); KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics"), Pattern.compile("^(.+)\\.kt$"), true, "helpers", "linked/type-inference", "linked/expressions.when-expression", "linked/type-system/type-kinds/type-parameters", "linked/type-system/subtyping", "linked/control--and-data-flow-analysis.control-flow-graph.expressions-1.conditional-expressions", "linked/declarations/classifier-declaration/classifier-initialization", "linked/declarations/function-declaration", "linked/annotations", "linked/statements", "linked/inheritance", "linked/expressions.conditional-expression", "linked/expressions/function-literals", "linked/expressions/built-in-types-and-their-semantics/kotlin.nothing-1/p-1/neg", "linked/overload-resolution", "linked/control--and-data-flow-analysis/performing-analysis-on-the-control-flow-graph");
} }
@TestMetadata("compiler/tests-spec/testData/diagnostics/linked") @TestMetadata("compiler/tests-spec/testData/diagnostics/linked")
@@ -37,7 +37,7 @@ public class DiagnosticsTestSpecGenerated extends AbstractDiagnosticsTestSpec {
} }
public void testAllFilesPresentInLinked() throws Exception { public void testAllFilesPresentInLinked() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked"), Pattern.compile("^(.+)\\.kt$"), true, "type-inference", "type-system/type-kinds/type-parameters", "type-system/subtyping", "control--and-data-flow-analysis.control-flow-graph.expressions-1.conditional-expressions", "declarations/classifier-declaration/classifier-initialization", "declarations/function-declaration", "annotations", "statements", "inheritance", "expressions.conditional-expression", "expressions/function-literals", "expressions/built-in-types-and-their-semantics/kotlin.nothing-1/p-1/neg", "overload-resolution", "control--and-data-flow-analysis/performing-analysis-on-the-control-flow-graph"); KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked"), Pattern.compile("^(.+)\\.kt$"), true, "type-inference", "expressions.when-expression", "type-system/type-kinds/type-parameters", "type-system/subtyping", "control--and-data-flow-analysis.control-flow-graph.expressions-1.conditional-expressions", "declarations/classifier-declaration/classifier-initialization", "declarations/function-declaration", "annotations", "statements", "inheritance", "expressions.conditional-expression", "expressions/function-literals", "expressions/built-in-types-and-their-semantics/kotlin.nothing-1/p-1/neg", "overload-resolution", "control--and-data-flow-analysis/performing-analysis-on-the-control-flow-graph");
} }
@TestMetadata("compiler/tests-spec/testData/diagnostics/linked/control--and-data-flow-analysis") @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/control--and-data-flow-analysis")
@@ -2058,6 +2058,86 @@ public class DiagnosticsTestSpecGenerated extends AbstractDiagnosticsTestSpec {
} }
} }
@TestMetadata("compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-3")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class P_3 extends AbstractDiagnosticsTestSpec {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInP_3() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-3"), Pattern.compile("^(.+)\\.kt$"), true);
}
@TestMetadata("compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-3/neg")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Neg extends AbstractDiagnosticsTestSpec {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
@TestMetadata("2.1.kt")
public void test2_1() throws Exception {
runTest("compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-3/neg/2.1.kt");
}
public void testAllFilesPresentInNeg() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-3/neg"), Pattern.compile("^(.+)\\.kt$"), true);
}
}
}
@TestMetadata("compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-4")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class P_4 extends AbstractDiagnosticsTestSpec {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInP_4() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-4"), Pattern.compile("^(.+)\\.kt$"), true);
}
@TestMetadata("compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-4/neg")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Neg extends AbstractDiagnosticsTestSpec {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
@TestMetadata("1.1.kt")
public void test1_1() throws Exception {
runTest("compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-4/neg/1.1.kt");
}
public void testAllFilesPresentInNeg() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-4/neg"), Pattern.compile("^(.+)\\.kt$"), true);
}
}
@TestMetadata("compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-4/pos")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Pos extends AbstractDiagnosticsTestSpec {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
@TestMetadata("1.1.kt")
public void test1_1() throws Exception {
runTest("compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-4/pos/1.1.kt");
}
public void testAllFilesPresentInPos() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-4/pos"), Pattern.compile("^(.+)\\.kt$"), true);
}
}
}
@TestMetadata("compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-5") @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-5")
@TestDataPath("$PROJECT_ROOT") @TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class) @RunWith(JUnit3RunnerWithInners.class)
@@ -25,7 +25,7 @@ public class BlackBoxCodegenTestSpecGenerated extends AbstractBlackBoxCodegenTes
} }
public void testAllFilesPresentInBox() throws Exception { public void testAllFilesPresentInBox() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box"), Pattern.compile("^(.+)\\.kt$"), true, "helpers", "templates", "linked/statements", "linked/expressions.conditional-expression", "linked/expressions/equality-expressions/reference-equality-expressions/p-1/neg", "linked/expressions/built-in-types-and-their-semantics/kotlin.unit/p-1/neg", "linked/expressions/prefix-expressions/prefix-increment-expression/p-1/neg"); KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box"), Pattern.compile("^(.+)\\.kt$"), true, "helpers", "templates", "linked/expressions.when-expression", "linked/statements", "linked/expressions.conditional-expression", "linked/expressions/equality-expressions/reference-equality-expressions/p-1/neg", "linked/expressions/built-in-types-and-their-semantics/kotlin.unit/p-1/neg", "linked/expressions/prefix-expressions/prefix-increment-expression/p-1/neg");
} }
@TestMetadata("compiler/tests-spec/testData/codegen/box/linked") @TestMetadata("compiler/tests-spec/testData/codegen/box/linked")
@@ -37,7 +37,7 @@ public class BlackBoxCodegenTestSpecGenerated extends AbstractBlackBoxCodegenTes
} }
public void testAllFilesPresentInLinked() throws Exception { public void testAllFilesPresentInLinked() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked"), Pattern.compile("^(.+)\\.kt$"), true, "statements", "expressions.conditional-expression", "expressions/equality-expressions/reference-equality-expressions/p-1/neg", "expressions/built-in-types-and-their-semantics/kotlin.unit/p-1/neg", "expressions/prefix-expressions/prefix-increment-expression/p-1/neg"); KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked"), Pattern.compile("^(.+)\\.kt$"), true, "expressions.when-expression", "statements", "expressions.conditional-expression", "expressions/equality-expressions/reference-equality-expressions/p-1/neg", "expressions/built-in-types-and-their-semantics/kotlin.unit/p-1/neg", "expressions/prefix-expressions/prefix-increment-expression/p-1/neg");
} }
@TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions") @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions")
@@ -1480,6 +1480,147 @@ public class BlackBoxCodegenTestSpecGenerated extends AbstractBlackBoxCodegenTes
} }
} }
} }
@TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class When_expression extends AbstractBlackBoxCodegenTestSpec {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInWhen_expression() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression"), Pattern.compile("^(.+)\\.kt$"), true);
}
@TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class P_4 extends AbstractBlackBoxCodegenTestSpec {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInP_4() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4"), Pattern.compile("^(.+)\\.kt$"), true);
}
@TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/neg")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Neg extends AbstractBlackBoxCodegenTestSpec {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
@TestMetadata("1.1.kt")
public void test1_1() throws Exception {
runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/neg/1.1.kt");
}
@TestMetadata("1.2.kt")
public void test1_2() throws Exception {
runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/neg/1.2.kt");
}
@TestMetadata("1.3.kt")
public void test1_3() throws Exception {
runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/neg/1.3.kt");
}
@TestMetadata("1.4.kt")
public void test1_4() throws Exception {
runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/neg/1.4.kt");
}
public void testAllFilesPresentInNeg() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/neg"), Pattern.compile("^(.+)\\.kt$"), true);
}
}
@TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/pos")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Pos extends AbstractBlackBoxCodegenTestSpec {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
@TestMetadata("1.1.kt")
public void test1_1() throws Exception {
runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/pos/1.1.kt");
}
@TestMetadata("1.2.kt")
public void test1_2() throws Exception {
runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/pos/1.2.kt");
}
@TestMetadata("1.3.kt")
public void test1_3() throws Exception {
runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/pos/1.3.kt");
}
@TestMetadata("1.4.kt")
public void test1_4() throws Exception {
runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/pos/1.4.kt");
}
public void testAllFilesPresentInPos() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/pos"), Pattern.compile("^(.+)\\.kt$"), true);
}
}
}
@TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-5")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class P_5 extends AbstractBlackBoxCodegenTestSpec {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInP_5() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-5"), Pattern.compile("^(.+)\\.kt$"), true);
}
@TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-5/neg")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Neg extends AbstractBlackBoxCodegenTestSpec {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
@TestMetadata("2.1.kt")
public void test2_1() throws Exception {
runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-5/neg/2.1.kt");
}
public void testAllFilesPresentInNeg() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-5/neg"), Pattern.compile("^(.+)\\.kt$"), true);
}
}
@TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-5/pos")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Pos extends AbstractBlackBoxCodegenTestSpec {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
@TestMetadata("1.1.kt")
public void test1_1() throws Exception {
runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-5/pos/1.1.kt");
}
public void testAllFilesPresentInPos() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-5/pos"), Pattern.compile("^(.+)\\.kt$"), true);
}
}
}
}
} }
@TestMetadata("compiler/tests-spec/testData/codegen/box/linked/type-system") @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/type-system")