Add test on bytecode text
Test data should be a Kotlin source file with zero or more comments e.g. of the form: '// 1 INVOKEVIRTUAL'. The test then checks that the generated bytecode for this file contains exactly one occurrence of the string 'INVOKEVIRTUAL'
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
fun foo() {
|
||||
if (0 < 1) {
|
||||
return
|
||||
}
|
||||
|
||||
if (1 < 2) else {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// 0 GETSTATIC
|
||||
@@ -0,0 +1,11 @@
|
||||
fun z(b: Boolean) {}
|
||||
|
||||
fun foo(b: Boolean) {
|
||||
if (b) {
|
||||
z(b)
|
||||
} else {
|
||||
z(b)
|
||||
}
|
||||
}
|
||||
|
||||
// 0 GETSTATIC
|
||||
@@ -0,0 +1,7 @@
|
||||
fun foo(b: Boolean) {
|
||||
if (b) {
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
||||
// 0 GETSTATIC
|
||||
@@ -0,0 +1,25 @@
|
||||
fun z() {}
|
||||
|
||||
fun foo() {
|
||||
try {
|
||||
z()
|
||||
} catch (e: Exception) {
|
||||
z()
|
||||
}
|
||||
|
||||
try {
|
||||
z()
|
||||
} finally {
|
||||
z()
|
||||
}
|
||||
|
||||
try {
|
||||
z()
|
||||
} catch (e: Exception) {
|
||||
z()
|
||||
} finally {
|
||||
z()
|
||||
}
|
||||
}
|
||||
|
||||
// 0 GETSTATIC
|
||||
@@ -0,0 +1,11 @@
|
||||
fun z() {}
|
||||
|
||||
fun foo(x: Int) {
|
||||
when {
|
||||
x == 21 -> z()
|
||||
x == 42 -> z()
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
|
||||
// 0 GETSTATIC
|
||||
@@ -0,0 +1,11 @@
|
||||
fun z() {}
|
||||
|
||||
fun foo(x: Int) {
|
||||
when (x) {
|
||||
21 -> z()
|
||||
42 -> z()
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
|
||||
// 0 GETSTATIC
|
||||
Reference in New Issue
Block a user