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:
+10
-10
@@ -1,14 +1,14 @@
|
||||
/*
|
||||
KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
|
||||
|
||||
SECTIONS: when-expression
|
||||
PARAGRAPH: 11
|
||||
SENTENCE: [1] It has an else entry;
|
||||
NUMBER: 1
|
||||
DESCRIPTION: Check when exhaustive via else entry (when without bound value).
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
|
||||
*
|
||||
* SECTIONS: when-expression
|
||||
* PARAGRAPH: 11
|
||||
* SENTENCE: [1] It has an else entry;
|
||||
* NUMBER: 1
|
||||
* DESCRIPTION: Check when exhaustive via else entry (when without bound value).
|
||||
*/
|
||||
|
||||
// CASE DESCRIPTION: Checking for exhaustive 'when' (several value check branches and 'else' branch).
|
||||
// TESTCASE NUMBER: 1
|
||||
fun case_1(value_1: Int): String = when {
|
||||
value_1 == 0 -> ""
|
||||
value_1 > 0 && value_1 <= 10 -> ""
|
||||
@@ -17,13 +17,13 @@ fun case_1(value_1: Int): String = when {
|
||||
else -> ""
|
||||
}
|
||||
|
||||
// CASE DESCRIPTION: Checking for exhaustive 'when' (value check branch and 'else' branch).
|
||||
// TESTCASE NUMBER: 2
|
||||
fun case_2(): String = when {
|
||||
true -> ""
|
||||
else -> ""
|
||||
}
|
||||
|
||||
// CASE DESCRIPTION: Checking for exhaustive 'when' (only 'else' branch).
|
||||
// TESTCASE NUMBER: 3
|
||||
fun case_3(): String = when {
|
||||
else -> ""
|
||||
}
|
||||
+12
-12
@@ -1,16 +1,16 @@
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION
|
||||
|
||||
/*
|
||||
KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
|
||||
|
||||
SECTIONS: when-expression
|
||||
PARAGRAPH: 11
|
||||
SENTENCE: [1] It has an else entry;
|
||||
NUMBER: 2
|
||||
DESCRIPTION: Check when exhaustive via else entry (when with bound value).
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
|
||||
*
|
||||
* SECTIONS: when-expression
|
||||
* PARAGRAPH: 11
|
||||
* SENTENCE: [1] It has an else entry;
|
||||
* NUMBER: 2
|
||||
* DESCRIPTION: Check when exhaustive via else entry (when with bound value).
|
||||
*/
|
||||
|
||||
// CASE DESCRIPTION: Checking for exhaustive 'when' (several branches).
|
||||
// TESTCASE NUMBER: 1
|
||||
fun case_1(value_1: Int): String = when (value_1) {
|
||||
0 -> ""
|
||||
1 -> ""
|
||||
@@ -19,22 +19,22 @@ fun case_1(value_1: Int): String = when (value_1) {
|
||||
else -> ""
|
||||
}
|
||||
|
||||
// CASE DESCRIPTION: Checking for exhaustive 'when' (value check branch and 'else' branch).
|
||||
// TESTCASE NUMBER: 2
|
||||
fun case_2(value_1: Boolean): String = when (value_1) {
|
||||
true -> ""
|
||||
else -> ""
|
||||
}
|
||||
|
||||
/*
|
||||
CASE DESCRIPTION: Checking for exhaustive 'when' with constant bound value (value check branch and 'else' branch).
|
||||
NOTE: for potential bound value constant analysis.
|
||||
* TESTCASE NUMBER: 3
|
||||
* NOTE: for a potential bound value constant analysis.
|
||||
*/
|
||||
fun case_3(): String = when (true) {
|
||||
true -> ""
|
||||
else -> ""
|
||||
}
|
||||
|
||||
// CASE DESCRIPTION: Checking for exhaustive 'when' (only 'else' branch).
|
||||
// TESTCASE NUMBER: 4
|
||||
fun case_4(value_1: Int): String = when(value_1) {
|
||||
else -> ""
|
||||
}
|
||||
+15
-15
@@ -2,16 +2,16 @@
|
||||
// !WITH_SEALED_CLASSES
|
||||
|
||||
/*
|
||||
KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
|
||||
|
||||
SECTIONS: when-expression
|
||||
PARAGRAPH: 11
|
||||
SENTENCE: [1] It has an else entry;
|
||||
NUMBER: 3
|
||||
DESCRIPTION: Check when exhaustive via else entry (when with bound value, redundant else).
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
|
||||
*
|
||||
* SECTIONS: when-expression
|
||||
* PARAGRAPH: 11
|
||||
* SENTENCE: [1] It has an else entry;
|
||||
* NUMBER: 3
|
||||
* DESCRIPTION: Check when exhaustive via else entry (when with bound value, redundant else).
|
||||
*/
|
||||
|
||||
// CASE DESCRIPTION: Checking for redundant 'else' branch (all enum values covered).
|
||||
// TESTCASE NUMBER: 1
|
||||
fun case_1(value_1: _EnumClass): String = when (value_1) {
|
||||
_EnumClass.EAST -> ""
|
||||
_EnumClass.NORTH -> ""
|
||||
@@ -20,7 +20,7 @@ fun case_1(value_1: _EnumClass): String = when (value_1) {
|
||||
<!REDUNDANT_ELSE_IN_WHEN!>else<!> -> ""
|
||||
}
|
||||
|
||||
// CASE DESCRIPTION: Checking for redundant 'else' branch (all enum values and null value covered).
|
||||
// TESTCASE NUMBER: 2
|
||||
fun case_2(value_1: _EnumClass?): String = when (value_1) {
|
||||
_EnumClass.EAST -> ""
|
||||
_EnumClass.NORTH -> ""
|
||||
@@ -30,14 +30,14 @@ fun case_2(value_1: _EnumClass?): String = when (value_1) {
|
||||
<!REDUNDANT_ELSE_IN_WHEN!>else<!> -> ""
|
||||
}
|
||||
|
||||
// CASE DESCRIPTION: Checking for redundant 'else' branch (both boolean value covered).
|
||||
// TESTCASE NUMBER: 3
|
||||
fun case_3(value_1: Boolean): String = when (value_1) {
|
||||
true -> ""
|
||||
false -> ""
|
||||
<!REDUNDANT_ELSE_IN_WHEN!>else<!> -> ""
|
||||
}
|
||||
|
||||
// CASE DESCRIPTION: Checking for redundant 'else' branch (both boolean value and null value covered).
|
||||
// TESTCASE NUMBER: 4
|
||||
fun case_4(value_1: Boolean?): String = when (value_1) {
|
||||
true -> ""
|
||||
false -> ""
|
||||
@@ -45,7 +45,7 @@ fun case_4(value_1: Boolean?): String = when (value_1) {
|
||||
<!REDUNDANT_ELSE_IN_WHEN!>else<!> -> ""
|
||||
}
|
||||
|
||||
// CASE DESCRIPTION: Checking for redundant 'else' branch (all sealed class subtypes covered).
|
||||
// TESTCASE NUMBER: 5
|
||||
fun case_5(value_1: _SealedClass): String = when (value_1) {
|
||||
is _SealedChild1 -> ""
|
||||
is _SealedChild2 -> ""
|
||||
@@ -53,7 +53,7 @@ fun case_5(value_1: _SealedClass): String = when (value_1) {
|
||||
<!REDUNDANT_ELSE_IN_WHEN!>else<!> -> ""
|
||||
}
|
||||
|
||||
// CASE DESCRIPTION: Checking for redundant 'else' branch (all sealed class subtypes and null value covered).
|
||||
// TESTCASE NUMBER: 6
|
||||
fun case_6(value_1: _SealedClass?): String = when (value_1) {
|
||||
is _SealedChild1 -> ""
|
||||
is _SealedChild2 -> ""
|
||||
@@ -62,13 +62,13 @@ fun case_6(value_1: _SealedClass?): String = when (value_1) {
|
||||
<!REDUNDANT_ELSE_IN_WHEN!>else<!> -> ""
|
||||
}
|
||||
|
||||
// CASE DESCRIPTION: Checking for redundant 'else' branch (sealed class itself covered).
|
||||
// TESTCASE NUMBER: 7
|
||||
fun case_7(value_1: _SealedClassSingle): String = when (value_1) {
|
||||
<!USELESS_IS_CHECK!>is _SealedClassSingle<!> -> ""
|
||||
<!REDUNDANT_ELSE_IN_WHEN!>else<!> -> ""
|
||||
}
|
||||
|
||||
// CASE DESCRIPTION: Checking for redundant 'else' branch (sealed class itself and null value covered).
|
||||
// TESTCASE NUMBER: 8
|
||||
fun case_8(value_1: _SealedClassSingle?): String = when (value_1) {
|
||||
is _SealedClassSingle -> ""
|
||||
null -> ""
|
||||
|
||||
+9
-9
@@ -1,20 +1,20 @@
|
||||
/*
|
||||
KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
|
||||
|
||||
SECTIONS: when-expression
|
||||
PARAGRAPH: 11
|
||||
SENTENCE: [3] The bound expression is of type kotlin.Boolean and the conditions contain both:
|
||||
NUMBER: 1
|
||||
DESCRIPTION: Check when exhaustive via boolean bound value and evaluating to value true and false.
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
|
||||
*
|
||||
* SECTIONS: when-expression
|
||||
* PARAGRAPH: 11
|
||||
* SENTENCE: [3] The bound expression is of type kotlin.Boolean and the conditions contain both:
|
||||
* NUMBER: 1
|
||||
* DESCRIPTION: Check when exhaustive via boolean bound value and evaluating to value true and false.
|
||||
*/
|
||||
|
||||
// CASE DESCRIPTION: Checking for exhaustive 'when' (both boolean value covered).
|
||||
// TESTCASE NUMBER: 1
|
||||
fun case_1(value_1: Boolean): String = when (value_1) {
|
||||
true -> ""
|
||||
false -> ""
|
||||
}
|
||||
|
||||
// CASE DESCRIPTION: Checking for exhaustive 'when' (both boolean value as complex expression covered).
|
||||
// TESTCASE NUMBER: 2
|
||||
fun case_2(value_1: Boolean): String = when (value_1) {
|
||||
true && false && ((true || false)) || true && !!!false && !!!true -> ""
|
||||
true && false && ((true || false)) || true && !!!false -> ""
|
||||
|
||||
+21
-21
@@ -2,42 +2,42 @@
|
||||
// !WITH_SEALED_CLASSES
|
||||
|
||||
/*
|
||||
KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
|
||||
|
||||
SECTIONS: when-expression
|
||||
PARAGRAPH: 11
|
||||
SENTENCE: [6] The bound valueession is of a sealed class type and all its possible subtypes are covered using type test conditions of this valueession;
|
||||
NUMBER: 1
|
||||
DESCRIPTION: Check when exhaustive when possible subtypes of the sealed class are covered.
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
|
||||
*
|
||||
* SECTIONS: when-expression
|
||||
* PARAGRAPH: 11
|
||||
* SENTENCE: [6] The bound valueession is of a sealed class type and all its possible subtypes are covered using type test conditions of this valueession;
|
||||
* NUMBER: 1
|
||||
* DESCRIPTION: Check when exhaustive when possible subtypes of the sealed class are covered.
|
||||
*/
|
||||
|
||||
// CASE DESCRIPTION: Checking for exhaustive 'when' (all sealed class subtypes covered).
|
||||
// TESTCASE NUMBER: 1
|
||||
fun case_1(value_1: _SealedClass): Int = when (value_1) {
|
||||
is _SealedChild1 -> <!DEBUG_INFO_SMARTCAST!>value_1<!>.number
|
||||
is _SealedChild2 -> <!DEBUG_INFO_SMARTCAST!>value_1<!>.e1 + <!DEBUG_INFO_SMARTCAST!>value_1<!>.e2
|
||||
is _SealedChild3 -> <!DEBUG_INFO_SMARTCAST!>value_1<!>.m1 + <!DEBUG_INFO_SMARTCAST!>value_1<!>.m2
|
||||
}
|
||||
|
||||
// CASE DESCRIPTION: Checking for exhaustive 'when' (single sealed class subtypes covered).
|
||||
// TESTCASE NUMBER: 2
|
||||
fun case_2(value_1: _SealedClass): String = when (value_1) {
|
||||
<!USELESS_IS_CHECK!>is _SealedClass<!> -> ""
|
||||
}
|
||||
|
||||
// CASE DESCRIPTION: Checking for exhaustive 'when' (all sealed class subtypes with methods covered).
|
||||
// TESTCASE NUMBER: 3
|
||||
fun case_3(value_1: _SealedClassWithMethods): String = when (value_1) {
|
||||
is _SealedWithMethodsChild1 -> <!DEBUG_INFO_SMARTCAST!>value_1<!>.m1()
|
||||
is _SealedWithMethodsChild2 -> <!DEBUG_INFO_SMARTCAST!>value_1<!>.m2()
|
||||
is _SealedWithMethodsChild3 -> <!DEBUG_INFO_SMARTCAST!>value_1<!>.m3()
|
||||
}
|
||||
|
||||
// CASE DESCRIPTION: Checking for exhaustive 'when' (all objects covered using implicit equality operator).
|
||||
// TESTCASE NUMBER: 4
|
||||
fun case_4(value_1: _SealedClassWithObjects): String = when (value_1) {
|
||||
_SealedWithObjectsChild1 -> ""
|
||||
_SealedWithObjectsChild2 -> ""
|
||||
_SealedWithObjectsChild3 -> ""
|
||||
}
|
||||
|
||||
// CASE DESCRIPTION: Checking for exhaustive 'when' (all subtypes and objects covered).
|
||||
// TESTCASE NUMBER: 5
|
||||
fun case_5(value_1: _SealedClassMixed): String = when (value_1) {
|
||||
is _SealedMixedChild1 -> ""
|
||||
is _SealedMixedChild2 -> ""
|
||||
@@ -48,8 +48,8 @@ fun case_5(value_1: _SealedClassMixed): String = when (value_1) {
|
||||
}
|
||||
|
||||
/*
|
||||
CASE DESCRIPTION: Checking for exhaustive 'when' (all subtypes and objects (using type checking operator) covered).
|
||||
DISCUSSION: is it correct that objects can be checked using the type checking operator?
|
||||
* TESTCASE NUMBER: 6
|
||||
* DISCUSSION: is it correct that objects can be checked using the type checking operator?
|
||||
*/
|
||||
fun case_6(value_1: _SealedClassMixed): String = when (value_1) {
|
||||
is _SealedMixedChild1 -> ""
|
||||
@@ -60,24 +60,24 @@ fun case_6(value_1: _SealedClassMixed): String = when (value_1) {
|
||||
is _SealedMixedChildObject3 -> ""
|
||||
}
|
||||
|
||||
// CASE DESCRIPTION: Checking for exhaustive 'when' on the empty sealed class (without subtypes).
|
||||
// TESTCASE NUMBER: 7
|
||||
fun case_7(value_1: _SealedClassEmpty): String = when (value_1) {
|
||||
else -> ""
|
||||
}
|
||||
|
||||
/*
|
||||
CASE DESCRIPTION: Checking for not exhaustive 'when' on opposite types.
|
||||
UNEXPECTED BEHAVIOUR: must be exhaustive
|
||||
ISSUES: KT-22996
|
||||
* TESTCASE NUMBER: 8
|
||||
* UNEXPECTED BEHAVIOUR: must be exhaustive
|
||||
* ISSUES: KT-22996
|
||||
*/
|
||||
fun case_8(value: _SealedClass?): String = <!NO_ELSE_IN_WHEN!>when<!> (value) {
|
||||
is _SealedChild1, !is _SealedChild3?, <!USELESS_IS_CHECK!>is _SealedChild3?<!> -> ""
|
||||
}
|
||||
|
||||
/*
|
||||
CASE DESCRIPTION: Checking for not exhaustive 'when' on opposite types.
|
||||
UNEXPECTED BEHAVIOUR: must be exhaustive
|
||||
ISSUES: KT-22996
|
||||
* TESTCASE NUMBER: 9
|
||||
* UNEXPECTED BEHAVIOUR: must be exhaustive
|
||||
* ISSUES: KT-22996
|
||||
*/
|
||||
fun case_9(value: _SealedClass?): String = <!NO_ELSE_IN_WHEN!>when<!> (value) {
|
||||
is _SealedChild1, !is _SealedChild3 -> ""
|
||||
|
||||
+9
-9
@@ -1,16 +1,16 @@
|
||||
// !WITH_ENUM_CLASSES
|
||||
|
||||
/*
|
||||
KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
|
||||
|
||||
SECTIONS: when-expression
|
||||
PARAGRAPH: 11
|
||||
SENTENCE: [7] The bound expression is of an Enum classes type and all enumerated values are checked for equality using constant conditions;
|
||||
NUMBER: 1
|
||||
DESCRIPTION: Check when exhaustive when all enumerated values are checked.
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
|
||||
*
|
||||
* SECTIONS: when-expression
|
||||
* PARAGRAPH: 11
|
||||
* SENTENCE: [7] The bound expression is of an Enum classes type and all enumerated values are checked for equality using constant conditions;
|
||||
* NUMBER: 1
|
||||
* DESCRIPTION: Check when exhaustive when all enumerated values are checked.
|
||||
*/
|
||||
|
||||
// CASE DESCRIPTION: Checking for exhaustive 'when' (all enum values covered).
|
||||
// TESTCASE NUMBER: 1
|
||||
fun case_1(dir: _EnumClass): String = when (dir) {
|
||||
_EnumClass.EAST -> ""
|
||||
_EnumClass.NORTH -> ""
|
||||
@@ -18,7 +18,7 @@ fun case_1(dir: _EnumClass): String = when (dir) {
|
||||
_EnumClass.WEST -> ""
|
||||
}
|
||||
|
||||
// CASE DESCRIPTION: Checking for exhaustive 'when' (single enum value covered).
|
||||
// TESTCASE NUMBER: 2
|
||||
fun case_2(value_1: _EnumClassSingle): String = when (value_1) {
|
||||
_EnumClassSingle.EVERYTHING -> ""
|
||||
}
|
||||
|
||||
+9
-9
@@ -1,21 +1,21 @@
|
||||
/*
|
||||
KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
|
||||
|
||||
SECTIONS: when-expression
|
||||
PARAGRAPH: 11
|
||||
SENTENCE: [8] The bound expression is of a nullable type and one of the areas above is met for its non-nullable counterpart and, in addition, there is a condition containing literal null.
|
||||
NUMBER: 1
|
||||
DESCRIPTION: Check when exhaustive when boolean values are checked and contains a null check.
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
|
||||
*
|
||||
* SECTIONS: when-expression
|
||||
* PARAGRAPH: 11
|
||||
* SENTENCE: [8] The bound expression is of a nullable type and one of the areas above is met for its non-nullable counterpart and, in addition, there is a condition containing literal null.
|
||||
* NUMBER: 1
|
||||
* DESCRIPTION: Check when exhaustive when boolean values are checked and contains a null check.
|
||||
*/
|
||||
|
||||
// CASE DESCRIPTION: Checking for exhaustive 'when' (both boolean values and null value covered).
|
||||
// TESTCASE NUMBER: 1
|
||||
fun case_1(value_1: Boolean?): String = when (value_1) {
|
||||
true -> ""
|
||||
false -> ""
|
||||
null -> ""
|
||||
}
|
||||
|
||||
// CASE DESCRIPTION: Checking for exhaustive 'when' (both boolean values as complex expressions and null value covered).
|
||||
// TESTCASE NUMBER: 2
|
||||
fun case_2(value_1: Boolean?): String = when (value_1) {
|
||||
true && false && ((true || false)) || true && !!!false && !!!true -> ""
|
||||
true && false && ((true || false)) || true && !!!false -> ""
|
||||
|
||||
+12
-12
@@ -1,16 +1,16 @@
|
||||
// !WITH_ENUM_CLASSES
|
||||
|
||||
/*
|
||||
KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
|
||||
|
||||
SECTIONS: when-expression
|
||||
PARAGRAPH: 11
|
||||
SENTENCE: [8] The bound expression is of a nullable type and one of the cases above is met for its non-nullable counterpart and, in addition, there is a condition containing literal null.
|
||||
NUMBER: 2
|
||||
DESCRIPTION: Check when exhaustive when enumerated values are checked and contains a null check.
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
|
||||
*
|
||||
* SECTIONS: when-expression
|
||||
* PARAGRAPH: 11
|
||||
* SENTENCE: [8] The bound expression is of a nullable type and one of the cases above is met for its non-nullable counterpart and, in addition, there is a condition containing literal null.
|
||||
* NUMBER: 2
|
||||
* DESCRIPTION: Check when exhaustive when enumerated values are checked and contains a null check.
|
||||
*/
|
||||
|
||||
// CASE DESCRIPTION: Checking for exhaustive 'when' (both enum values and null value covered).
|
||||
// TESTCASE NUMBER: 1
|
||||
fun case_1(value_1: _EnumClass?): String = when (value_1) {
|
||||
_EnumClass.EAST -> ""
|
||||
_EnumClass.NORTH -> ""
|
||||
@@ -19,16 +19,16 @@ fun case_1(value_1: _EnumClass?): String = when (value_1) {
|
||||
null -> ""
|
||||
}
|
||||
|
||||
// CASE DESCRIPTION: Checking for exhaustive 'when' (single enum value and null value covered).
|
||||
// TESTCASE NUMBER: 2
|
||||
fun case_2(value_1: _EnumClassSingle?): String = when (value_1) {
|
||||
_EnumClassSingle.EVERYTHING -> ""
|
||||
null -> ""
|
||||
}
|
||||
|
||||
/*
|
||||
CASE DESCRIPTION: Checking for not exhaustive 'when' on the empty nullable enum class.
|
||||
UNEXPECTED BEHAVIOUR
|
||||
ISSUES: KT-26044
|
||||
* TESTCASE NUMBER: 3
|
||||
* UNEXPECTED BEHAVIOUR
|
||||
* ISSUES: KT-26044
|
||||
*/
|
||||
fun case_3(value_1: _EnumClassEmpty?): String = <!NO_ELSE_IN_WHEN!>when<!>(value_1) {
|
||||
null -> ""
|
||||
|
||||
+17
-17
@@ -1,16 +1,16 @@
|
||||
// !WITH_SEALED_CLASSES
|
||||
|
||||
/*
|
||||
KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
|
||||
|
||||
SECTIONS: when-expression
|
||||
PARAGRAPH: 11
|
||||
SENTENCE: [8] The bound expression is of a nullable type and one of the areas above is met for its non-nullable counterpart and, in addition, there is a condition containing literal null.
|
||||
NUMBER: 3
|
||||
DESCRIPTION: Check when exhaustive when possible subtypes of the sealed class are covered and contains a null check.
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
|
||||
*
|
||||
* SECTIONS: when-expression
|
||||
* PARAGRAPH: 11
|
||||
* SENTENCE: [8] The bound expression is of a nullable type and one of the areas above is met for its non-nullable counterpart and, in addition, there is a condition containing literal null.
|
||||
* NUMBER: 3
|
||||
* DESCRIPTION: Check when exhaustive when possible subtypes of the sealed class are covered and contains a null check.
|
||||
*/
|
||||
|
||||
// CASE DESCRIPTION: Checking for exhaustive 'when' (all sealed class subtypes and null value covered).
|
||||
// TESTCASE NUMBER: 1
|
||||
fun case_1(value_1: _SealedClass?): Int = when (value_1) {
|
||||
is _SealedChild1 -> <!DEBUG_INFO_SMARTCAST!>value_1<!>.number
|
||||
is _SealedChild2 -> <!DEBUG_INFO_SMARTCAST!>value_1<!>.e1 + <!DEBUG_INFO_SMARTCAST!>value_1<!>.e2
|
||||
@@ -18,13 +18,13 @@ fun case_1(value_1: _SealedClass?): Int = when (value_1) {
|
||||
null -> 0
|
||||
}
|
||||
|
||||
// CASE DESCRIPTION: Checking for exhaustive 'when' (sealed class itself and null value covered).
|
||||
// TESTCASE NUMBER: 2
|
||||
fun case_2(value_1: _SealedClass?): String = when (value_1) {
|
||||
is _SealedClass -> ""
|
||||
null -> ""
|
||||
}
|
||||
|
||||
// CASE DESCRIPTION: Checking for exhaustive 'when' (all sealed class with methods subtypes and null value covered).
|
||||
// TESTCASE NUMBER: 3
|
||||
fun case_3(value_1: _SealedClassWithMethods?): String = when (value_1) {
|
||||
is _SealedWithMethodsChild1 -> <!DEBUG_INFO_SMARTCAST!>value_1<!>.m1()
|
||||
is _SealedWithMethodsChild2 -> <!DEBUG_INFO_SMARTCAST!>value_1<!>.m2()
|
||||
@@ -32,7 +32,7 @@ fun case_3(value_1: _SealedClassWithMethods?): String = when (value_1) {
|
||||
null -> ""
|
||||
}
|
||||
|
||||
// CASE DESCRIPTION: Checking for exhaustive 'when' (all objects covered using implicit equality operator and null value covered).
|
||||
// TESTCASE NUMBER: 4
|
||||
fun case_4(value_1: _SealedClassWithObjects?): String = when (value_1) {
|
||||
_SealedWithObjectsChild1 -> ""
|
||||
_SealedWithObjectsChild2 -> ""
|
||||
@@ -40,7 +40,7 @@ fun case_4(value_1: _SealedClassWithObjects?): String = when (value_1) {
|
||||
null -> ""
|
||||
}
|
||||
|
||||
// CASE DESCRIPTION: Checking for exhaustive 'when' (all subtypes and objects covered + null value covered).
|
||||
// TESTCASE NUMBER: 5
|
||||
fun case_5(value_1: _SealedClassMixed?): String = when (value_1) {
|
||||
is _SealedMixedChild1 -> ""
|
||||
is _SealedMixedChild2 -> ""
|
||||
@@ -52,8 +52,8 @@ fun case_5(value_1: _SealedClassMixed?): String = when (value_1) {
|
||||
}
|
||||
|
||||
/*
|
||||
CASE DESCRIPTION: Checking for exhaustive 'when' (all subtypes and objects (using type checking operator) covered + null value covered).
|
||||
DISCUSSION: is it correct that objects can be checked using the type checking operator?
|
||||
* TESTCASE NUMBER: 6
|
||||
* DISCUSSION: is it correct that objects can be checked using the type checking operator?
|
||||
*/
|
||||
fun case_6(value_1: _SealedClassMixed?): String = when (value_1) {
|
||||
is _SealedMixedChild1 -> ""
|
||||
@@ -66,9 +66,9 @@ fun case_6(value_1: _SealedClassMixed?): String = when (value_1) {
|
||||
}
|
||||
|
||||
/*
|
||||
CASE DESCRIPTION: Checking for not exhaustive 'when' on the empty nullable sealed class (without subtypes).
|
||||
UNEXPECTED BEHAVIOUR: must be exhaustive
|
||||
ISSUES: KT-26044
|
||||
* TESTCASE NUMBER: 7
|
||||
* UNEXPECTED BEHAVIOUR: must be exhaustive
|
||||
* ISSUES: KT-26044
|
||||
*/
|
||||
fun case_7(value: _SealedClassEmpty?): String = <!NO_ELSE_IN_WHEN!>when<!> (value) {
|
||||
null -> ""
|
||||
|
||||
Reference in New Issue
Block a user