[Spec tests] Review fix tests for try-expression and if-expression
This commit is contained in:
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
/*
|
||||
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-218
|
||||
* PLACE: expressions, conditional-expression -> paragraph 1 -> sentence 2
|
||||
* NUMBER: 1
|
||||
* DESCRIPTION: if-expression: check the correct branch is evaluating
|
||||
*/
|
||||
|
||||
fun box(): String {
|
||||
if (true) return "OK" else "false branch"
|
||||
return "NOK"
|
||||
}
|
||||
Vendored
+16
@@ -0,0 +1,16 @@
|
||||
|
||||
// WITH_RUNTIME
|
||||
|
||||
/*
|
||||
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-218
|
||||
* PLACE: expressions, conditional-expression -> paragraph 1 -> sentence 2
|
||||
* NUMBER: 2
|
||||
* DESCRIPTION: if-expression: check the correct branch is evaluating
|
||||
*/
|
||||
|
||||
fun box(): String {
|
||||
if (false) "true" else return "OK"
|
||||
return "NOK"
|
||||
}
|
||||
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
|
||||
// WITH_RUNTIME
|
||||
|
||||
/*
|
||||
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-218
|
||||
* PLACE: expressions, conditional-expression -> paragraph 1 -> sentence 2
|
||||
* RELEVANT PLACES: expressions, conditional-expression -> paragraph 4 -> sentence 2
|
||||
* NUMBER: 3
|
||||
* DESCRIPTION: if-expression: check the correct branch is evaluating
|
||||
*/
|
||||
|
||||
fun box(): String {
|
||||
if (false) return "NOK"
|
||||
return "OK"
|
||||
}
|
||||
Vendored
+16
@@ -0,0 +1,16 @@
|
||||
|
||||
// WITH_RUNTIME
|
||||
|
||||
/*
|
||||
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-218
|
||||
* PLACE: expressions, conditional-expression -> paragraph 1 -> sentence 2
|
||||
* NUMBER: 4
|
||||
* DESCRIPTION: if-expression: check the correct branch is evaluating
|
||||
*/
|
||||
|
||||
fun box(): String {
|
||||
if (false) else return "OK"
|
||||
return "NOK"
|
||||
}
|
||||
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
/*
|
||||
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-218
|
||||
* PLACE: expressions, conditional-expression -> paragraph 2 -> sentence 1
|
||||
* NUMBER: 1
|
||||
* DESCRIPTION:
|
||||
*/
|
||||
|
||||
fun box(): String {
|
||||
if (true) else;
|
||||
return "OK"
|
||||
}
|
||||
Vendored
+57
@@ -0,0 +1,57 @@
|
||||
{
|
||||
"1": {
|
||||
"pos": {
|
||||
"2": [
|
||||
{
|
||||
"specVersion": "0.1-218",
|
||||
"casesNumber": 0,
|
||||
"description": "if-expression: check the correct branch is evaluating",
|
||||
"unexpectedBehaviour": false
|
||||
},
|
||||
{
|
||||
"specVersion": "0.1-218",
|
||||
"casesNumber": 0,
|
||||
"description": "if-expression: check the correct branch is evaluating",
|
||||
"unexpectedBehaviour": false
|
||||
},
|
||||
{
|
||||
"specVersion": "0.1-218",
|
||||
"casesNumber": 0,
|
||||
"description": "if-expression: check the correct branch is evaluating",
|
||||
"unexpectedBehaviour": false
|
||||
},
|
||||
{
|
||||
"specVersion": "0.1-218",
|
||||
"casesNumber": 0,
|
||||
"description": "if-expression: check the correct branch is evaluating",
|
||||
"unexpectedBehaviour": false
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"4": {
|
||||
"pos": {
|
||||
"2": [
|
||||
{
|
||||
"specVersion": "0.1-218",
|
||||
"casesNumber": 0,
|
||||
"description": "if-expression: check the correct branch is evaluating",
|
||||
"path": "compiler/tests-spec/testData/codegen/box/linked/expressions/conditional-expression/p-1/pos/2.3.kt",
|
||||
"unexpectedBehaviour": false
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"2": {
|
||||
"pos": {
|
||||
"1": [
|
||||
{
|
||||
"specVersion": "0.1-218",
|
||||
"casesNumber": 0,
|
||||
"description": "",
|
||||
"unexpectedBehaviour": false
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-3
@@ -15,7 +15,6 @@ fun box(): String {
|
||||
var isTryExecuted = false
|
||||
var isCatched = false
|
||||
var isFinallyExecuted = false
|
||||
var isExecutedFully = false
|
||||
try {
|
||||
isTryExecuted = true
|
||||
} catch (e: Exception) {
|
||||
@@ -23,7 +22,6 @@ fun box(): String {
|
||||
} finally {
|
||||
isFinallyExecuted = true
|
||||
}
|
||||
isExecutedFully = true
|
||||
return if (isTryExecuted && !isCatched && isFinallyExecuted && isExecutedFully) "OK"
|
||||
return if (isTryExecuted && !isCatched && isFinallyExecuted) "OK"
|
||||
else "NOK"
|
||||
}
|
||||
+1
-3
@@ -16,7 +16,6 @@ fun box(): String {
|
||||
var isTryExecuted = false
|
||||
var isCatched = false
|
||||
var isFinallyExecuted = false
|
||||
var isExecutedFully = false
|
||||
try {
|
||||
isTryExecuted = true
|
||||
throwException(true)
|
||||
@@ -25,7 +24,6 @@ fun box(): String {
|
||||
} finally {
|
||||
isFinallyExecuted = true
|
||||
}
|
||||
isExecutedFully = true
|
||||
return if (isTryExecuted &&isCatched && isFinallyExecuted && isExecutedFully) "OK"
|
||||
return if (isTryExecuted &&isCatched && isFinallyExecuted) "OK"
|
||||
else "NOK"
|
||||
}
|
||||
+1
-4
@@ -19,7 +19,6 @@ fun box(): String {
|
||||
var isTryExecuted = false
|
||||
var isCatched = false
|
||||
var isFinallyExecuted = false
|
||||
var isExecutedFully = false
|
||||
var isTryExpressionPropagated = false
|
||||
|
||||
try {
|
||||
@@ -35,12 +34,10 @@ fun box(): String {
|
||||
isTryExpressionPropagated = true
|
||||
}
|
||||
|
||||
isExecutedFully = true
|
||||
return if (isTryExecuted &&
|
||||
!isCatched &&
|
||||
isFinallyExecuted &&
|
||||
isTryExpressionPropagated &&
|
||||
isExecutedFully
|
||||
isTryExpressionPropagated
|
||||
) "OK"
|
||||
else "NOK"
|
||||
}
|
||||
Reference in New Issue
Block a user