Add a JVM backend debug information test, this commit is for verifying
line numbers for stepping. Running JVM instance and read stepping events from it to verify with the test data.
This commit is contained in:
committed by
max-kammerer
parent
f17e9ba9fe
commit
0a2812f83b
@@ -0,0 +1,16 @@
|
||||
//FILE: test.kt
|
||||
fun cond() = false
|
||||
|
||||
fun box() {
|
||||
if (cond())
|
||||
cond()
|
||||
else
|
||||
false
|
||||
}
|
||||
|
||||
// LINENUMBERS
|
||||
// TestKt.box():5
|
||||
// TestKt.cond():2
|
||||
// TestKt.box():5
|
||||
// TestKt.box():8
|
||||
// TestKt.box():9
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
//FILE: test.kt
|
||||
fun box() {
|
||||
val k = if (getA()
|
||||
&& getB()
|
||||
&& getC()
|
||||
&& getD()) {
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
fun getA() = true
|
||||
|
||||
fun getB() = true
|
||||
|
||||
fun getC() = false
|
||||
|
||||
fun getD() = true
|
||||
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// IR backend is missing a line number 3 in box() after stepping on line 9 for getting the result of false
|
||||
|
||||
// LINENUMBERS
|
||||
// TestKt.box():3
|
||||
// TestKt.getA():13
|
||||
// TestKt.box():3
|
||||
// TestKt.box():4
|
||||
// TestKt.getB():15
|
||||
// TestKt.box():4
|
||||
// TestKt.box():5
|
||||
// TestKt.getC():17
|
||||
// TestKt.box():5
|
||||
// TestKt.box():9
|
||||
// TestKt.box():3
|
||||
// TestKt.box():11
|
||||
@@ -0,0 +1,38 @@
|
||||
//FILE: foo.kt
|
||||
import bar
|
||||
fun foo(x: Int): Int {
|
||||
if (x >= 0) { // 4
|
||||
return x // 5
|
||||
}
|
||||
return bar(x) // 7
|
||||
}
|
||||
|
||||
//FILE: test.kt
|
||||
import foo
|
||||
fun box() {
|
||||
foo(-3) //4
|
||||
}
|
||||
|
||||
fun bar(x: Int) =
|
||||
if (x < 0) { //8
|
||||
foo(0)
|
||||
} else { // 10
|
||||
foo(x)
|
||||
}
|
||||
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
// IR backend has bar().12 replaced as bar().8 for returning bar() function result.
|
||||
// LINENUMBERS
|
||||
// TestKt.box():4
|
||||
// FooKt.foo(int):4
|
||||
// FooKt.foo(int):7
|
||||
// TestKt.bar(int):8
|
||||
// TestKt.bar(int):9
|
||||
// FooKt.foo(int):4
|
||||
// FooKt.foo(int):5
|
||||
// TestKt.bar(int):9
|
||||
// TestKt.bar(int):12
|
||||
// FooKt.foo(int):7
|
||||
// TestKt.box():4
|
||||
// TestKt.box():5
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
//FILE: test.kt
|
||||
fun box(): Int {
|
||||
if (
|
||||
getB() ==
|
||||
getA())
|
||||
return 0
|
||||
return getB()
|
||||
}
|
||||
|
||||
fun getA() = 3
|
||||
|
||||
inline fun getB(): Int {
|
||||
return 1
|
||||
}
|
||||
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// old backend is missing a line number after return from inline function call, actually IR backend results seems more right.
|
||||
|
||||
// LINENUMBERS
|
||||
// TestKt.box():4
|
||||
// TestKt.box():13
|
||||
// TestKt.box():5
|
||||
// TestKt.getA():10
|
||||
// TestKt.box():5
|
||||
// TestKt.box():7
|
||||
// TestKt.box():13
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
//FILE: test.kt
|
||||
fun box() {
|
||||
val n = 3
|
||||
val k = foo(n)
|
||||
}
|
||||
|
||||
fun foo(n :Int ) : Int {
|
||||
if (n == 1 || n == 0) {
|
||||
return 1
|
||||
}
|
||||
return foo(n-1) * n
|
||||
}
|
||||
|
||||
// LINENUMBERS
|
||||
// TestKt.box():3
|
||||
// TestKt.box():4
|
||||
// TestKt.foo(int):8
|
||||
// TestKt.foo(int):11
|
||||
// TestKt.foo(int):8
|
||||
// TestKt.foo(int):11
|
||||
// TestKt.foo(int):8
|
||||
// TestKt.foo(int):9
|
||||
// TestKt.foo(int):11
|
||||
// TestKt.foo(int):11
|
||||
// TestKt.box():4
|
||||
// TestKt.box():5
|
||||
@@ -0,0 +1,29 @@
|
||||
//FILE: test.kt
|
||||
fun box() {
|
||||
val a = 1
|
||||
val b = 2
|
||||
try {
|
||||
throwIfLess(a, b)
|
||||
} catch (e: java.lang.Exception) {
|
||||
throwIfLess(a, b)
|
||||
}
|
||||
throwIfLess(b,a)
|
||||
}
|
||||
|
||||
fun throwIfLess(a: Int, b: Int) {
|
||||
if (a<b)
|
||||
throw java.lang.IllegalStateException()
|
||||
}
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// after throwing exception in try block, IR backend is returning a line number at line 6 instead of line 7 where catch statement is in.
|
||||
// LINENUMBERS
|
||||
// TestKt.box():3
|
||||
// TestKt.box():4
|
||||
// TestKt.box():5
|
||||
// TestKt.box():6
|
||||
// TestKt.throwIfLess(int, int):14
|
||||
// TestKt.throwIfLess(int, int):15
|
||||
// TestKt.box():7
|
||||
// TestKt.box():8
|
||||
// TestKt.throwIfLess(int, int):14
|
||||
// TestKt.throwIfLess(int, int):15
|
||||
Reference in New Issue
Block a user