[Spec tests] Updating tests for kotlin 1.4.0

This commit is contained in:
anastasiia.spaseeva
2019-12-02 17:20:28 +03:00
committed by Victor Petukhov
parent ab3b63c92a
commit 1caafdc9d4
46 changed files with 707 additions and 833 deletions
@@ -424,13 +424,6 @@
"path": "compiler/testData/diagnostics/tests/when/ExhaustivePlatformEnumElse.kt",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-152",
"casesNumber": 0,
"description": "Kt9929",
"path": "compiler/testData/diagnostics/tests/when/kt9929.kt",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-152",
"casesNumber": 0,
@@ -640,31 +633,6 @@
}
},
"1": {
"pos": {
"1": [
{
"specVersion": "0.1-152",
"casesNumber": 0,
"description": "Kt9929",
"path": "compiler/testData/diagnostics/tests/when/kt9929.kt",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-152",
"casesNumber": 0,
"description": "Kt4434",
"path": "compiler/testData/diagnostics/tests/when/kt4434.kt",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-152",
"casesNumber": 0,
"description": "Non exhaustive boolean nullable",
"path": "compiler/testData/diagnostics/tests/when/NonExhaustiveBooleanNullable.kt",
"unexpectedBehaviour": false
}
]
},
"neg": {
"1": [
{
@@ -759,6 +727,24 @@
"unexpectedBehaviour": false
}
]
},
"pos": {
"1": [
{
"specVersion": "0.1-152",
"casesNumber": 0,
"description": "Kt4434",
"path": "compiler/testData/diagnostics/tests/when/kt4434.kt",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-152",
"casesNumber": 0,
"description": "Non exhaustive boolean nullable",
"path": "compiler/testData/diagnostics/tests/when/NonExhaustiveBooleanNullable.kt",
"unexpectedBehaviour": false
}
]
}
},
"3": {
@@ -116,11 +116,15 @@ fun case_8(value_1: Int, value_2: Int) = when {
else "4"
}
// TESTCASE NUMBER: 9
/*
* TESTCASE NUMBER: 9
* UNEXPECTED BEHAVIOUR
* ISSUES: KT-37249
*/
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 { }<!>
value_1 == 1 -> try { 4 } catch (e: Exception) { 5 }
value_1 == 2 -> try { throw Exception() } catch (e: Exception) { value_2 }
else -> try { throw Exception() } catch (e: Exception) <!TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH!>{ {<!TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH!>value_3<!>} }<!> finally { }
}
// TESTCASE NUMBER: 10
@@ -1,19 +1,19 @@
// SKIP_TXT
/*
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-100
* PLACE: expressions, when-expression -> paragraph 2 -> sentence 1
* NUMBER: 1
* DESCRIPTION: Forbidden break and continue in the control structure body of when.
* NUMBER: 2
* DESCRIPTION: Allowed break and continue in the control structure body of when.
*/
// TESTCASE NUMBER: 1
fun case_1(value_1: Int): String {
while (true) {
when {
value_1 == 1 -> <!BREAK_OR_CONTINUE_IN_WHEN!>break<!>
value_1 == 1 -> break
}
}
@@ -24,7 +24,7 @@ fun case_1(value_1: Int): String {
fun case_2(value_1: Int): String {
while (true) {
when {
value_1 == 1 -> <!BREAK_OR_CONTINUE_IN_WHEN!>continue<!>
value_1 == 1 -> continue
}
}
@@ -117,12 +117,16 @@ fun case_8(value_1: Int, value_2: Int) = when (value_1) {
else "4"
}
// TESTCASE NUMBER: 9
/*
* TESTCASE NUMBER: 9
* UNEXPECTED BEHAVIOUR
* ISSUES: KT-37249
*/
fun case_9(value_1: Int, value_2: String, value_3: String): Any {
return when (value_1) {
1 -> try { 4 } catch (e: Exception) { 5 }
2 -> try { throw Exception() } catch (e: Exception) { value_2 }
else -> try { throw Exception() } catch (e: Exception) { {value_3} } finally { }
else -> try { throw Exception() } catch (e: Exception) <!TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH!>{ {<!TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH!>value_3<!>} }<!> finally { }
}
}
@@ -1,12 +1,12 @@
// SKIP_TXT
/*
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-100
* PLACE: expressions, when-expression -> paragraph 5 -> sentence 1
* NUMBER: 1
* DESCRIPTION: 'When' with bound value and not allowed break and continue expression (without labels) in the control structure body.
* NUMBER: 2
* DESCRIPTION: 'When' with bound value and allowed break and continue expression (without labels) in the control structure body.
*/
// TESTCASE NUMBER: 1
@@ -14,7 +14,7 @@ fun case_1(value_1: Int): Int {
while (true) {
when (value_1) {
1 -> return 1
2 -> <!BREAK_OR_CONTINUE_IN_WHEN!>break<!>
2 -> break
}
}
@@ -25,7 +25,7 @@ fun case_1(value_1: Int): Int {
fun case_2(value_1: Int): Int {
while (true) {
when (value_1) {
1 -> <!BREAK_OR_CONTINUE_IN_WHEN!>continue<!>
1 -> continue
2 -> return 1
}
}
@@ -1,11 +1,11 @@
// SKIP_TXT
/*
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-201
* PLACE: expressions, when-expression -> paragraph 6 -> sentence 11
* NUMBER: 2
* NUMBER: 1
* DESCRIPTION: 'When' with bound value and not allowed break and continue expression (without labels) in 'when condition'.
*/
@@ -13,7 +13,7 @@
fun case_1(value_1: Int): String {
while (true) {
when (value_1) {
<!BREAK_OR_CONTINUE_IN_WHEN!>break<!><!UNREACHABLE_CODE!><!> -> <!UNREACHABLE_CODE!>return ""<!>
break<!UNREACHABLE_CODE!><!> -> <!UNREACHABLE_CODE!>return ""<!>
}
}
@@ -24,7 +24,7 @@ fun case_1(value_1: Int): String {
fun case_2(value_1: Int): String {
while (true) {
when (value_1) {
<!BREAK_OR_CONTINUE_IN_WHEN!>continue<!><!UNREACHABLE_CODE!><!> -> <!UNREACHABLE_CODE!>return ""<!>
continue<!UNREACHABLE_CODE!><!> -> <!UNREACHABLE_CODE!>return ""<!>
}
}
File diff suppressed because it is too large Load Diff