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:
Alexander Udalov
2013-02-09 21:44:33 +04:00
parent fe96a0172d
commit 620143ae5b
23 changed files with 259 additions and 169 deletions
@@ -14,4 +14,6 @@ class Tester() {
fun S.component4() = ((a + b) as java.lang.String).substring(2)
}
fun box() = Tester().box()
fun box() = Tester().box()
// 1 NEW S
@@ -0,0 +1,3 @@
fun foo() = 10!!.toString()
// 0 IFNONNULL
@@ -0,0 +1,5 @@
val a : Int? = 10
fun foo() = a!!.toString()
// 1 IFNONNULL
@@ -0,0 +1,5 @@
val a : Int? = 10
fun foo() = a?.toString()
// 1 IFNULL
@@ -0,0 +1,3 @@
fun foo() = 10?.toString()
// 0 IFNULL
@@ -15,4 +15,7 @@ class B {
fun foo() {
foo = 2
}
}
}
// 0 INVOKEVIRTUAL
// 4 INVOKESPECIAL
@@ -12,5 +12,6 @@ class Child: Base<String>() {
override fun bar() {
super.bar()
}
}
// 1 bridge
@@ -11,3 +11,6 @@ class B {
fun box(): String {
return "OK"
}
// 0 INVOKEVIRTUAL
// 3 INVOKESPECIAL
@@ -7,3 +7,5 @@ fun foo(b: Boolean) {
z(b)
}
}
// 0 GETSTATIC
@@ -3,3 +3,5 @@ fun foo(b: Boolean) {
} else {
}
}
// 0 GETSTATIC
@@ -7,3 +7,5 @@ fun foo(x: Int) {
else -> {}
}
}
// 0 GETSTATIC
@@ -7,3 +7,5 @@ fun foo(x: Int) {
else -> {}
}
}
// 0 GETSTATIC