backend/tests:
* enable 'expression_as_statement'
* add unit{1..4}
This commit is contained in:
committed by
SvyatoslavScherbina
parent
43b3902a0f
commit
276e3bcd44
@@ -769,7 +769,6 @@ task initializers4(type: RunKonanTest) {
|
||||
}
|
||||
|
||||
task expression_as_statement(type: RunKonanTest) {
|
||||
disabled = true
|
||||
goldValue = "Ok\n"
|
||||
source = "codegen/basics/expression_as_statement.kt"
|
||||
}
|
||||
@@ -792,4 +791,24 @@ task memory_var3(type: RunKonanTest) {
|
||||
task memory_var4(type: RunKonanTest) {
|
||||
disabled = true
|
||||
source = "runtime/memory/var4.kt"
|
||||
}
|
||||
|
||||
task unit1(type: RunKonanTest) {
|
||||
goldValue = "First\nkotlin.Unit\n"
|
||||
source = "codegen/basics/unit1.kt"
|
||||
}
|
||||
|
||||
task unit2(type: RunKonanTest) {
|
||||
goldValue = "kotlin.Unit\n"
|
||||
source = "codegen/basics/unit2.kt"
|
||||
}
|
||||
|
||||
task unit3(type: RunKonanTest) {
|
||||
goldValue = "kotlin.Unit\n"
|
||||
source = "codegen/basics/unit3.kt"
|
||||
}
|
||||
|
||||
task unit4(type: RunKonanTest) {
|
||||
goldValue = "Done\n"
|
||||
source = "codegen/basics/unit4.kt"
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fun main(args: Array<String>) {
|
||||
println(println("First").toString())
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
fun main(args: Array<String>) {
|
||||
val x = foo()
|
||||
println(x.toString())
|
||||
}
|
||||
|
||||
fun foo() {
|
||||
return Unit
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fun main(args: Array<String>) {
|
||||
foo(Unit)
|
||||
}
|
||||
|
||||
fun foo(x: Any) {
|
||||
println(x.toString())
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
fun main(args: Array<String>) {
|
||||
for (x in 0 .. 8) {
|
||||
foo(x, Unit)
|
||||
}
|
||||
println("Done")
|
||||
}
|
||||
|
||||
var global = 42
|
||||
|
||||
fun foo(x: Int, unit: Unit) {
|
||||
var local = 5
|
||||
val y: Unit = when (x) {
|
||||
0 -> {}
|
||||
1 -> local = 6
|
||||
2 -> global = 43
|
||||
3 -> unit
|
||||
4 -> Unit
|
||||
5 -> bar()
|
||||
6 -> return
|
||||
7 -> {
|
||||
5
|
||||
bar()
|
||||
}
|
||||
8 -> {
|
||||
val z: Any = Unit
|
||||
z as Unit
|
||||
}
|
||||
else -> throw Error()
|
||||
}
|
||||
|
||||
if (y !== Unit) {
|
||||
println("Fail at x = $x")
|
||||
}
|
||||
}
|
||||
|
||||
fun bar() {
|
||||
}
|
||||
Reference in New Issue
Block a user