[Spec tests] Add tests for expressions and statements
This commit is contained in:
committed by
Victor Petukhov
parent
5f4a94a1b3
commit
5986ffae1e
+38
@@ -0,0 +1,38 @@
|
||||
// !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-222
|
||||
* PLACE: expressions, jump-expressions, continue-expression -> paragraph 1 -> sentence 1
|
||||
* NUMBER: 1
|
||||
* DESCRIPTION: A continue expression is a jump expression allowed only within loop bodies.
|
||||
*/
|
||||
|
||||
|
||||
// TESTCASE NUMBER: 1
|
||||
fun case1() {
|
||||
val inputList = listOf(1, 2, 3)
|
||||
inputList.forEach {
|
||||
listOf("1.", "2.", "3.").forEach {
|
||||
if (true) <!NOT_A_LOOP_LABEL!>continue<!LABEL_NAME_CLASH!>@forEach<!><!>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 2
|
||||
fun case2() {
|
||||
val inputList = listOf(1, 2, 3)
|
||||
inputList.forEach {
|
||||
listOf("1.", "2.", "3.").forEach {
|
||||
if (true) <!BREAK_OR_CONTINUE_OUTSIDE_A_LOOP!>continue<!>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 3
|
||||
fun case3() {
|
||||
<!BREAK_OR_CONTINUE_OUTSIDE_A_LOOP!>continue<!>
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"1": {
|
||||
"neg": {
|
||||
"1": [
|
||||
{
|
||||
"specVersion": "0.1-222",
|
||||
"casesNumber": 3,
|
||||
"description": "A continue expression is a jump expression allowed only within loop bodies.",
|
||||
"unexpectedBehaviour": false
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user