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:
+3
-1
@@ -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
|
||||
+4
-1
@@ -15,4 +15,7 @@ class B {
|
||||
fun foo() {
|
||||
foo = 2
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 0 INVOKEVIRTUAL
|
||||
// 4 INVOKESPECIAL
|
||||
+2
-1
@@ -12,5 +12,6 @@ class Child: Base<String>() {
|
||||
override fun bar() {
|
||||
super.bar()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 1 bridge
|
||||
+3
@@ -11,3 +11,6 @@ class B {
|
||||
fun box(): String {
|
||||
return "OK"
|
||||
}
|
||||
|
||||
// 0 INVOKEVIRTUAL
|
||||
// 3 INVOKESPECIAL
|
||||
+2
@@ -7,3 +7,5 @@ fun foo() {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// 0 GETSTATIC
|
||||
+2
@@ -7,3 +7,5 @@ fun foo(b: Boolean) {
|
||||
z(b)
|
||||
}
|
||||
}
|
||||
|
||||
// 0 GETSTATIC
|
||||
+2
@@ -3,3 +3,5 @@ fun foo(b: Boolean) {
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
||||
// 0 GETSTATIC
|
||||
+2
@@ -21,3 +21,5 @@ fun foo() {
|
||||
z()
|
||||
}
|
||||
}
|
||||
|
||||
// 0 GETSTATIC
|
||||
+2
@@ -7,3 +7,5 @@ fun foo(x: Int) {
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
|
||||
// 0 GETSTATIC
|
||||
+2
@@ -7,3 +7,5 @@ fun foo(x: Int) {
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
|
||||
// 0 GETSTATIC
|
||||
Reference in New Issue
Block a user