Reorganize spec tests infrastructure code
- Add the tests mute system for the diagnostic tests - Move the code for the test info parsing to the separate package `parsers` - Unification of the `linked` and `not linked` spec tests - Package structure is refactored - Change the multiline comment format with a test information - Actualize `PrintSpecTestsStatistic` - Other different code improvements
This commit is contained in:
+9
-9
@@ -1,14 +1,14 @@
|
||||
/*
|
||||
KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
|
||||
|
||||
SECTIONS: when-expression
|
||||
PARAGRAPH: 3
|
||||
SENTENCE: [1] When expression without bound value (the form where the expression enclosed in parantheses is absent) evaluates one of the many different expressions based on corresponding conditions present in the same when entry.
|
||||
NUMBER: 1
|
||||
DESCRIPTION: 'When' without bound value and not allowed break and continue expression (without labels) in the control structure body.
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
|
||||
*
|
||||
* SECTIONS: when-expression
|
||||
* PARAGRAPH: 3
|
||||
* SENTENCE: [1] When expression without bound value (the form where the expression enclosed in parantheses is absent) evaluates one of the many different expressions based on corresponding conditions present in the same when entry.
|
||||
* NUMBER: 1
|
||||
* DESCRIPTION: 'When' without bound value and not allowed break and continue expression (without labels) in the control structure body.
|
||||
*/
|
||||
|
||||
// CASE DESCRIPTION: 'When' with break expression (without label).
|
||||
// TESTCASE NUMBER: 1
|
||||
fun case_1(value_1: Int): String {
|
||||
while (true) {
|
||||
when {
|
||||
@@ -19,7 +19,7 @@ fun case_1(value_1: Int): String {
|
||||
return ""
|
||||
}
|
||||
|
||||
// CASE DESCRIPTION: 'When' with continue expression (without label).
|
||||
// TESTCASE NUMBER: 2
|
||||
fun case_2(value_1: Int): String {
|
||||
while (true) {
|
||||
when {
|
||||
|
||||
+8
-7
@@ -1,15 +1,16 @@
|
||||
// !WITH_BASIC_TYPES
|
||||
|
||||
/*
|
||||
KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
|
||||
|
||||
SECTIONS: when-expression
|
||||
PARAGRAPH: 3
|
||||
SENTENCE: [2] Each entry consists of a boolean condition (or a special else condition), each of which is checked and evaluated in order of appearance.
|
||||
NUMBER: 1
|
||||
DESCRIPTION: 'When' without bound value and with not boolean condition in 'when condition'.
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
|
||||
*
|
||||
* SECTIONS: when-expression
|
||||
* PARAGRAPH: 3
|
||||
* SENTENCE: [2] Each entry consists of a boolean condition (or a special else condition), each of which is checked and evaluated in order of appearance.
|
||||
* NUMBER: 1
|
||||
* DESCRIPTION: 'When' without bound value and with not boolean condition in 'when condition'.
|
||||
*/
|
||||
|
||||
// TESTCASE NUMBER: 1
|
||||
fun case_1(value_1: Int, value_2: String, value_3: _BasicTypesProvider): String {
|
||||
when {
|
||||
<!TYPE_MISMATCH!>.012f / value_1<!> -> return ""
|
||||
|
||||
+8
-7
@@ -1,15 +1,16 @@
|
||||
// !WITH_BASIC_TYPES
|
||||
|
||||
/*
|
||||
KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
|
||||
|
||||
SECTIONS: when-expression
|
||||
PARAGRAPH: 3
|
||||
SENTENCE: [2] Each entry consists of a boolean condition (or a special else condition), each of which is checked and evaluated in order of appearance.
|
||||
NUMBER: 2
|
||||
DESCRIPTION: 'When' without bound value and not allowed comma in when entry.
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
|
||||
*
|
||||
* SECTIONS: when-expression
|
||||
* PARAGRAPH: 3
|
||||
* SENTENCE: [2] Each entry consists of a boolean condition (or a special else condition), each of which is checked and evaluated in order of appearance.
|
||||
* NUMBER: 2
|
||||
* DESCRIPTION: 'When' without bound value and not allowed comma in when entry.
|
||||
*/
|
||||
|
||||
// TESTCASE NUMBER: 1
|
||||
fun case_1(value_1: _BasicTypesProvider) {
|
||||
when {
|
||||
getBoolean()<!COMMA_IN_WHEN_CONDITION_WITHOUT_ARGUMENT!>,<!> value_1.getBoolean() -> return
|
||||
|
||||
+32
-32
@@ -4,16 +4,16 @@
|
||||
// !WITH_FUNCTIONS
|
||||
|
||||
/*
|
||||
KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
|
||||
|
||||
SECTIONS: when-expression
|
||||
PARAGRAPH: 3
|
||||
SENTENCE: [1] When expression without bound value (the form where the expression enclosed in parantheses is absent) evaluates one of the many different expressions based on corresponding conditions present in the same when entry.
|
||||
NUMBER: 1
|
||||
DESCRIPTION: 'When' without bound value and with different variants of expressions in the control structure body.
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
|
||||
*
|
||||
* SECTIONS: when-expression
|
||||
* PARAGRAPH: 3
|
||||
* SENTENCE: [1] When expression without bound value (the form where the expression enclosed in parantheses is absent) evaluates one of the many different expressions based on corresponding conditions present in the same when entry.
|
||||
* NUMBER: 1
|
||||
* DESCRIPTION: 'When' without bound value and with different variants of expressions in the control structure body.
|
||||
*/
|
||||
|
||||
// CASE DESCRIPTION: 'When' with control structure body as literals.
|
||||
// TESTCASE NUMBER: 1
|
||||
fun case_1(value_1: Int) {
|
||||
when {
|
||||
value_1 == 1 -> true
|
||||
@@ -25,7 +25,7 @@ fun case_1(value_1: Int) {
|
||||
}
|
||||
}
|
||||
|
||||
// CASE DESCRIPTION: 'When' with control structure body as arithmetic expressions.
|
||||
// TESTCASE NUMBER: 2
|
||||
fun case_2(value_1: Int, value_2: Byte, value_3: _BasicTypesProvider) {
|
||||
when {
|
||||
value_1 == 1 -> -.09 % 10L
|
||||
@@ -34,7 +34,7 @@ fun case_2(value_1: Int, value_2: Byte, value_3: _BasicTypesProvider) {
|
||||
}
|
||||
}
|
||||
|
||||
// CASE DESCRIPTION: 'When' with control structure body as boolean expressions (logical, equality and comparison).
|
||||
// TESTCASE NUMBER: 3
|
||||
fun case_3(value_1: Int, value_2: Boolean, value_3: Long) {
|
||||
when {
|
||||
value_1 == 1 -> value_2
|
||||
@@ -46,7 +46,7 @@ fun case_3(value_1: Int, value_2: Boolean, value_3: Long) {
|
||||
}
|
||||
}
|
||||
|
||||
// CASE DESCRIPTION: 'When' with control structure body as concatenations.
|
||||
// TESTCASE NUMBER: 4
|
||||
fun case_4(value_1: Int, value_2: String, value_3: String) {
|
||||
when {
|
||||
value_1 == 1 -> "..." + value_2 + "" + "$value_3" + "..."
|
||||
@@ -54,7 +54,7 @@ fun case_4(value_1: Int, value_2: String, value_3: String) {
|
||||
}
|
||||
}
|
||||
|
||||
// CASE DESCRIPTION: 'When' with control structure body as when expression.
|
||||
// TESTCASE NUMBER: 5
|
||||
fun case_5(value_1: Int, value_2: Int, value_3: Boolean?) {
|
||||
when {
|
||||
value_1 == 1 -> when {
|
||||
@@ -80,7 +80,7 @@ fun case_5(value_1: Int, value_2: Int, value_3: Boolean?) {
|
||||
}
|
||||
}
|
||||
|
||||
// CASE DESCRIPTION: 'When' as expression with control structure body as when expression (must be exhaustive).
|
||||
// TESTCASE NUMBER: 6
|
||||
fun case_6(value_1: Int, value_2: Int, value_3: Boolean?) = when {
|
||||
value_1 == 1 -> when {
|
||||
value_2 > 1000 -> 1
|
||||
@@ -94,7 +94,7 @@ fun case_6(value_1: Int, value_2: Int, value_3: Boolean?) = when {
|
||||
}
|
||||
}
|
||||
|
||||
// CASE DESCRIPTION: 'When' with control structure body as if expression.
|
||||
// TESTCASE NUMBER: 7
|
||||
fun case_7(value_1: Int, value_2: Int, value_3: Boolean?) {
|
||||
when {
|
||||
value_1 == 1 -> if (value_2 > 1000) "1"
|
||||
@@ -109,7 +109,7 @@ fun case_7(value_1: Int, value_2: Int, value_3: Boolean?) {
|
||||
}
|
||||
}
|
||||
|
||||
// CASE DESCRIPTION: 'When' as expression with control structure body as if expression (must be exhaustive).
|
||||
// TESTCASE NUMBER: 8
|
||||
fun case_8(value_1: Int, value_2: Int) = when {
|
||||
value_1 == 1 -> if (value_2 > 1000) "1"
|
||||
else "2"
|
||||
@@ -118,14 +118,14 @@ fun case_8(value_1: Int, value_2: Int) = when {
|
||||
else "4"
|
||||
}
|
||||
|
||||
// CASE DESCRIPTION: 'When' with control structure body as try expression.
|
||||
// TESTCASE NUMBER: 9
|
||||
fun case_9(value_1: Int, value_2: String, value_3: String) = when {
|
||||
value_1 == 1 -> <!IMPLICIT_CAST_TO_ANY!>try { 4 } catch (e: Exception) { 5 }<!>
|
||||
value_1 == 2 -> <!IMPLICIT_CAST_TO_ANY!>try { throw Exception() } catch (e: Exception) { value_2 }<!>
|
||||
else -> <!IMPLICIT_CAST_TO_ANY!>try { throw Exception() } catch (e: Exception) { {value_3} } finally { }<!>
|
||||
}
|
||||
|
||||
// CASE DESCRIPTION: 'When' with control structure body as elvis operator expression.
|
||||
// TESTCASE NUMBER: 10
|
||||
fun case_10(value_1: Int, value_2: String?, value_3: String?) {
|
||||
when {
|
||||
value_1 == 1 -> value_2 ?: true
|
||||
@@ -134,7 +134,7 @@ fun case_10(value_1: Int, value_2: String?, value_3: String?) {
|
||||
}
|
||||
}
|
||||
|
||||
// CASE DESCRIPTION: 'When' with control structure body as range expression.
|
||||
// TESTCASE NUMBER: 11
|
||||
fun case_11(value_1: Int) {
|
||||
when {
|
||||
value_1 == 1 -> 1..10
|
||||
@@ -143,7 +143,7 @@ fun case_11(value_1: Int) {
|
||||
}
|
||||
}
|
||||
|
||||
// CASE DESCRIPTION: 'When' with control structure body as cast expression.
|
||||
// TESTCASE NUMBER: 12
|
||||
fun case_12(value_1: Int, value_2: Collection<Int>, value_3: Collection<Int>?) {
|
||||
when {
|
||||
value_1 == 1 -> value_2 as MutableList<Int>
|
||||
@@ -153,7 +153,7 @@ fun case_12(value_1: Int, value_2: Collection<Int>, value_3: Collection<Int>?) {
|
||||
}
|
||||
}
|
||||
|
||||
// CASE DESCRIPTION: 'When' with control structure body as prefix operator expression.
|
||||
// TESTCASE NUMBER: 13
|
||||
fun case_13(value_1: Int, value_2: Int, value_3: Int, value_4: Boolean) {
|
||||
var mutablevalue_2 = value_2
|
||||
var mutablevalue_3 = value_3
|
||||
@@ -165,7 +165,7 @@ fun case_13(value_1: Int, value_2: Int, value_3: Int, value_4: Boolean) {
|
||||
}
|
||||
}
|
||||
|
||||
// CASE DESCRIPTION: 'When' with control structure body as postfix operator expression.
|
||||
// TESTCASE NUMBER: 14
|
||||
fun case_14(value_1: Int, value_2: Int, value_3: Int, value_4: Boolean?) {
|
||||
var mutablevalue_2 = value_2
|
||||
var mutablevalue_3 = value_3
|
||||
@@ -177,7 +177,7 @@ fun case_14(value_1: Int, value_2: Int, value_3: Int, value_4: Boolean?) {
|
||||
}
|
||||
}
|
||||
|
||||
// CASE DESCRIPTION: 'When' with control structure body as indexing expression.
|
||||
// TESTCASE NUMBER: 15
|
||||
fun case_15(value_1: Int, value_2: List<Int>, value_3: List<List<List<List<Int>>>>) {
|
||||
when {
|
||||
value_1 == 1 -> value_2[0]
|
||||
@@ -185,7 +185,7 @@ fun case_15(value_1: Int, value_2: List<Int>, value_3: List<List<List<List<Int>>
|
||||
}
|
||||
}
|
||||
|
||||
// CASE DESCRIPTION: 'When' with control structure body as call expression.
|
||||
// TESTCASE NUMBER: 16
|
||||
fun case_16(value_1: Int, value_2: _Class, value_3: _Class?, value_4: Int) {
|
||||
fun __fun_1(): () -> Unit { return fun() { } }
|
||||
|
||||
@@ -198,7 +198,7 @@ fun case_16(value_1: Int, value_2: _Class, value_3: _Class?, value_4: Int) {
|
||||
}
|
||||
}
|
||||
|
||||
// CASE DESCRIPTION: 'When' with control structure body as property access expression.
|
||||
// TESTCASE NUMBER: 17
|
||||
fun case_17(value_1: Int, value_2: _Class, value_3: _Class?) {
|
||||
when {
|
||||
value_1 == 1 -> value_2.prop_1
|
||||
@@ -208,7 +208,7 @@ fun case_17(value_1: Int, value_2: _Class, value_3: _Class?) {
|
||||
}
|
||||
}
|
||||
|
||||
// CASE DESCRIPTION: 'When' with control structure body as fun literal.
|
||||
// TESTCASE NUMBER: 18
|
||||
fun case_18(value_1: Int) {
|
||||
val fun_1 = fun(): Int { return 0 }
|
||||
|
||||
@@ -220,7 +220,7 @@ fun case_18(value_1: Int) {
|
||||
}
|
||||
}
|
||||
|
||||
// CASE DESCRIPTION: 'When' with control structure body as lambda literal.
|
||||
// TESTCASE NUMBER: 19
|
||||
fun case_19(value_1: Int): () -> Any {
|
||||
val lambda_1 = { 0 }
|
||||
|
||||
@@ -233,7 +233,7 @@ fun case_19(value_1: Int): () -> Any {
|
||||
}
|
||||
}
|
||||
|
||||
// CASE DESCRIPTION: 'When' with control structure body as object literal.
|
||||
// TESTCASE NUMBER: 20
|
||||
fun case_20(value_1: Int) {
|
||||
val object_1 = object {
|
||||
val prop_1 = 1
|
||||
@@ -249,7 +249,7 @@ fun case_20(value_1: Int) {
|
||||
}
|
||||
}
|
||||
|
||||
// CASE DESCRIPTION: 'When' with control structure body as this expression.
|
||||
// TESTCASE NUMBER: 21
|
||||
class A {
|
||||
val prop_1 = 1
|
||||
val lambda_1 = { 1 }
|
||||
@@ -269,7 +269,7 @@ class A {
|
||||
}
|
||||
}
|
||||
|
||||
// CASE DESCRIPTION: 'When' with control structure body as throw expression.
|
||||
// TESTCASE NUMBER: 22
|
||||
fun case_22(value_1: Int) {
|
||||
when {
|
||||
value_1 == 1 -> throw Exception()
|
||||
@@ -277,7 +277,7 @@ fun case_22(value_1: Int) {
|
||||
}
|
||||
}
|
||||
|
||||
// CASE DESCRIPTION: 'When' with control structure body as return expression.
|
||||
// TESTCASE NUMBER: 23
|
||||
fun case_23(value_1: Int) {
|
||||
fun r_1() {
|
||||
when {
|
||||
@@ -296,7 +296,7 @@ fun case_23(value_1: Int) {
|
||||
}
|
||||
}
|
||||
|
||||
// CASE DESCRIPTION: 'When' with control structure body as continue expression.
|
||||
// TESTCASE NUMBER: 24
|
||||
fun case_24(value_1: Int) {
|
||||
loop1@ while (true) {
|
||||
loop2@ while (true) {
|
||||
@@ -308,7 +308,7 @@ fun case_24(value_1: Int) {
|
||||
}
|
||||
}
|
||||
|
||||
// CASE DESCRIPTION: 'When' with control structure body as break expression.
|
||||
// TESTCASE NUMBER: 25
|
||||
fun case_25(value_1: Int) {
|
||||
loop1@ while (true) {
|
||||
loop2@ while (true) {
|
||||
|
||||
+22
-22
@@ -3,16 +3,16 @@
|
||||
// !WITH_ENUM_CLASSES
|
||||
|
||||
/*
|
||||
KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
|
||||
|
||||
SECTIONS: when-expression
|
||||
PARAGRAPH: 3
|
||||
SENTENCE: [2] Each entry consists of a boolean condition (or a special else condition), each of which is checked and evaluated in order of appearance.
|
||||
NUMBER: 1
|
||||
DESCRIPTION: 'When' without bound value and different variants of the boolean conditions (logical, equality, comparison, type checking operator, containment operator).
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
|
||||
*
|
||||
* SECTIONS: when-expression
|
||||
* PARAGRAPH: 3
|
||||
* SENTENCE: [2] Each entry consists of a boolean condition (or a special else condition), each of which is checked and evaluated in order of appearance.
|
||||
* NUMBER: 1
|
||||
* DESCRIPTION: 'When' without bound value and different variants of the boolean conditions (logical, equality, comparison, type checking operator, containment operator).
|
||||
*/
|
||||
|
||||
// CASE DESCRIPTION: 'When' with boolean expressions and else branch.
|
||||
// TESTCASE NUMBER: 1
|
||||
fun case_1(value_1: Boolean, value_2: Long): Int {
|
||||
return when {
|
||||
value_1 -> 1
|
||||
@@ -26,8 +26,8 @@ fun case_1(value_1: Boolean, value_2: Long): Int {
|
||||
}
|
||||
|
||||
/*
|
||||
CASE DESCRIPTION: 'When' with boolean expressions.
|
||||
NOTE: for potential analysys on exhaustive by enum of when without bound value.
|
||||
* TESTCASE NUMBER: 2
|
||||
* NOTE: for a potential analysys of exhaustiveness by enums in whens without a bound value.
|
||||
*/
|
||||
fun case_2(value_1: _EnumClass) {
|
||||
when {
|
||||
@@ -39,8 +39,8 @@ fun case_2(value_1: _EnumClass) {
|
||||
}
|
||||
|
||||
/*
|
||||
CASE DESCRIPTION: 'When' with boolean expressions.
|
||||
NOTE: for potential analysys on exhaustive by boolean of when without bound value.
|
||||
* TESTCASE NUMBER: 3
|
||||
* NOTE: for a potential analysys of exhaustiveness by enums in whens without a bound value.
|
||||
*/
|
||||
fun case_3(value_1: Boolean) {
|
||||
when {
|
||||
@@ -50,8 +50,8 @@ fun case_3(value_1: Boolean) {
|
||||
}
|
||||
|
||||
/*
|
||||
CASE DESCRIPTION: 'When' with boolean literals.
|
||||
NOTE: for potential mark code after true branch as unreacable.
|
||||
* TESTCASE NUMBER: 4
|
||||
* NOTE: for a potential mark the code after the true branch as unreacable.
|
||||
*/
|
||||
fun case_4(value_1: Boolean) {
|
||||
when {
|
||||
@@ -62,8 +62,8 @@ fun case_4(value_1: Boolean) {
|
||||
}
|
||||
|
||||
/*
|
||||
CASE DESCRIPTION: 'When' with boolean constants.
|
||||
NOTE: for potential const propagation use in this case.
|
||||
* TESTCASE NUMBER: 5
|
||||
* NOTE: for a potential const propagation.
|
||||
*/
|
||||
fun case_5(value_1: Boolean) {
|
||||
val value_2 = false
|
||||
@@ -76,7 +76,7 @@ fun case_5(value_1: Boolean) {
|
||||
}
|
||||
}
|
||||
|
||||
// CASE DESCRIPTION: 'When' with type checking operator.
|
||||
// TESTCASE NUMBER: 6
|
||||
fun case_6(value_1: Any) {
|
||||
when {
|
||||
value_1 is Nothing -> {}
|
||||
@@ -90,8 +90,8 @@ fun case_6(value_1: Any) {
|
||||
}
|
||||
|
||||
/*
|
||||
CASE DESCRIPTION: 'When' with invert type checking operator.
|
||||
NOTE: for potential analysys on exhaustive of when without bound value_1.
|
||||
* TESTCASE NUMBER: 7
|
||||
* NOTE: for a potential analysys of exhaustiveness by enums in whens without a bound value.
|
||||
*/
|
||||
fun case_7(value_1: Any) {
|
||||
when {
|
||||
@@ -103,8 +103,8 @@ fun case_7(value_1: Any) {
|
||||
}
|
||||
|
||||
/*
|
||||
CASE DESCRIPTION: 'When' with type checking operator by sealed class.
|
||||
NOTE: for potential analysys on exhaustive by sealed class of when without bound value_1.
|
||||
* TESTCASE NUMBER: 8
|
||||
* NOTE: for a potential analysys of exhaustiveness by enums in whens without a bound value.
|
||||
*/
|
||||
fun case_8(value_1: _SealedClass) {
|
||||
when {
|
||||
@@ -114,7 +114,7 @@ fun case_8(value_1: _SealedClass) {
|
||||
}
|
||||
}
|
||||
|
||||
// CASE DESCRIPTION: 'When' with containment operator.
|
||||
// TESTCASE NUMBER: 9
|
||||
fun case_9(value_1: Int, value_2: IntRange) {
|
||||
when {
|
||||
value_1 in -10..100L -> {}
|
||||
|
||||
+9
-9
@@ -1,19 +1,19 @@
|
||||
/*
|
||||
KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
|
||||
|
||||
SECTIONS: when-expression
|
||||
PARAGRAPH: 3
|
||||
SENTENCE: [2] Each entry consists of a boolean condition (or a special else condition), each of which is checked and evaluated in order of appearance.
|
||||
NUMBER: 2
|
||||
DESCRIPTION: 'When' without bound value and only one 'else' branch.
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
|
||||
*
|
||||
* SECTIONS: when-expression
|
||||
* PARAGRAPH: 3
|
||||
* SENTENCE: [2] Each entry consists of a boolean condition (or a special else condition), each of which is checked and evaluated in order of appearance.
|
||||
* NUMBER: 2
|
||||
* DESCRIPTION: 'When' without bound value and only one 'else' branch.
|
||||
*/
|
||||
|
||||
// CASE DESCRIPTION: 'When' as expression with only one 'else' branch.
|
||||
// TESTCASE NUMBER: 1
|
||||
fun case_1() = when {
|
||||
else -> ""
|
||||
}
|
||||
|
||||
// CASE DESCRIPTION: 'When' as statement with only one 'else' branch.
|
||||
// TESTCASE NUMBER: 2
|
||||
fun case_2(): String {
|
||||
when {
|
||||
else -> return ""
|
||||
|
||||
+15
-15
@@ -1,18 +1,18 @@
|
||||
// !WITH_BASIC_TYPES
|
||||
|
||||
/*
|
||||
KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
|
||||
|
||||
SECTIONS: when-expression
|
||||
PARAGRAPH: 3
|
||||
SENTENCE: [2] Each entry consists of a boolean condition (or a special else condition), each of which is checked and evaluated in order of appearance.
|
||||
NUMBER: 3
|
||||
DESCRIPTION: 'When' without bound value and with Nothing in condition (subtype of Boolean).
|
||||
DISCUSSION
|
||||
ISSUES: KT-25948
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
|
||||
*
|
||||
* SECTIONS: when-expression
|
||||
* PARAGRAPH: 3
|
||||
* SENTENCE: [2] Each entry consists of a boolean condition (or a special else condition), each of which is checked and evaluated in order of appearance.
|
||||
* NUMBER: 3
|
||||
* DESCRIPTION: 'When' without bound value and with Nothing in condition (subtype of Boolean).
|
||||
* DISCUSSION
|
||||
* ISSUES: KT-25948
|
||||
*/
|
||||
|
||||
// CASE DESCRIPTION: 'When' with return expression in condition.
|
||||
// TESTCASE NUMBER: 1
|
||||
fun case_1(<!UNUSED_PARAMETER!>value_1<!>: _BasicTypesProvider) {
|
||||
when {
|
||||
return -> <!UNREACHABLE_CODE!>return<!>
|
||||
@@ -23,7 +23,7 @@ fun case_1(<!UNUSED_PARAMETER!>value_1<!>: _BasicTypesProvider) {
|
||||
}
|
||||
}
|
||||
|
||||
// CASE DESCRIPTION: 'When' with throw expression in condition.
|
||||
// TESTCASE NUMBER: 2
|
||||
fun case_2(<!UNUSED_PARAMETER!>value_1<!>: _BasicTypesProvider) {
|
||||
when {
|
||||
throw Exception() -> <!UNREACHABLE_CODE!>return<!>
|
||||
@@ -34,7 +34,7 @@ fun case_2(<!UNUSED_PARAMETER!>value_1<!>: _BasicTypesProvider) {
|
||||
}
|
||||
}
|
||||
|
||||
// CASE DESCRIPTION: 'When' with break expression in condition.
|
||||
// TESTCASE NUMBER: 3
|
||||
fun case_3(<!UNUSED_PARAMETER!>value_1<!>: _BasicTypesProvider) {
|
||||
loop1@ while (true) {
|
||||
loop2@ while (true) {
|
||||
@@ -49,7 +49,7 @@ fun case_3(<!UNUSED_PARAMETER!>value_1<!>: _BasicTypesProvider) {
|
||||
}
|
||||
}
|
||||
|
||||
// CASE DESCRIPTION: 'When' with continue expression in condition.
|
||||
// TESTCASE NUMBER: 4
|
||||
fun case_4(<!UNUSED_PARAMETER!>value_1<!>: _BasicTypesProvider): String {
|
||||
loop1@ while (true) {
|
||||
loop2@ while (true) {
|
||||
@@ -64,7 +64,7 @@ fun case_4(<!UNUSED_PARAMETER!>value_1<!>: _BasicTypesProvider): String {
|
||||
}
|
||||
}
|
||||
|
||||
// CASE DESCRIPTION: 'When' with values of Nothing type.
|
||||
// TESTCASE NUMBER: 6
|
||||
fun case_6(value_1: Nothing, <!UNUSED_PARAMETER!>value_2<!>: _BasicTypesProvider): String {
|
||||
when {
|
||||
value_1 -> <!UNREACHABLE_CODE!>return ""<!>
|
||||
@@ -76,7 +76,7 @@ fun case_6(value_1: Nothing, <!UNUSED_PARAMETER!>value_2<!>: _BasicTypesProvider
|
||||
<!UNREACHABLE_CODE!>return ""<!>
|
||||
}
|
||||
|
||||
// CASE DESCRIPTION: 'When' with mixed Nothing expression in condition.
|
||||
// TESTCASE NUMBER: 5
|
||||
fun case_5(<!UNUSED_PARAMETER!>value_1<!>: _BasicTypesProvider, <!UNUSED_PARAMETER!>value_2<!>: Nothing) {
|
||||
loop1@ while (true) {
|
||||
loop2@ while (true) {
|
||||
|
||||
Reference in New Issue
Block a user