[Spec tests] Add tests for kotlin.Nothing and kotlin.Unit built-in types
This commit is contained in:
+23
@@ -0,0 +1,23 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
/*
|
||||
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-213
|
||||
* PLACE: expressions, built-in-types-and-their-semantics, kotlin.nothing-1 -> paragraph 1 -> sentence 1
|
||||
* NUMBER: 1
|
||||
* DESCRIPTION: todo
|
||||
*/
|
||||
|
||||
fun foo(): Nothing {
|
||||
throw Exception()
|
||||
}
|
||||
|
||||
fun box() {
|
||||
try {
|
||||
foo()
|
||||
} catch (e: Exception) {
|
||||
return "OK"
|
||||
}
|
||||
return "NOK"
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"1": {
|
||||
"pos": {
|
||||
"1": [
|
||||
{
|
||||
"specVersion": "0.1-213",
|
||||
"casesNumber": 0,
|
||||
"description": "todo",
|
||||
"unexpectedBehaviour": false
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
/*
|
||||
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-213
|
||||
* PLACE: expressions, built-in-types-and-their-semantics, kotlin.unit -> paragraph 1 -> sentence 1
|
||||
* NUMBER: 1
|
||||
* DESCRIPTION: todo
|
||||
*/
|
||||
|
||||
fun foo1() {
|
||||
return Unit
|
||||
}
|
||||
|
||||
fun foo2(): Unit {
|
||||
return Unit
|
||||
}
|
||||
|
||||
fun foo3(): Unit {
|
||||
}
|
||||
|
||||
fun box(){
|
||||
val u1 = foo1()
|
||||
val u2 = foo2()
|
||||
val u3 = foo3()
|
||||
if (u1 === u2 && u1 === u3 && u2 === u3) {
|
||||
return ( "OK")
|
||||
}
|
||||
return ( "NOK")
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"1": {
|
||||
"pos": {
|
||||
"1": [
|
||||
{
|
||||
"specVersion": "0.1-213",
|
||||
"casesNumber": 0,
|
||||
"description": "todo",
|
||||
"unexpectedBehaviour": false
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user