[K2/N] Unlock old testinfra runs with K2 frontend
Merge-request: KT-MR-8552 Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
This commit is contained in:
committed by
Space Team
parent
b01ef8465a
commit
26b6c0b310
@@ -1,39 +0,0 @@
|
||||
import kotlin.text.Regex
|
||||
import kotlin.test.*
|
||||
|
||||
fun main() {
|
||||
try {
|
||||
val array = intArrayOf(1, 2, 3, 4)
|
||||
println(array[4])
|
||||
}
|
||||
catch (e:Exception) {
|
||||
val stackTrace = e.getStackTrace()
|
||||
stackTrace.take(goldValues.size).forEach(::checkFrame)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
internal val regex = Regex("^(\\d+)\\ +.*/(.*):(\\d+):.*$")
|
||||
internal val goldValues = arrayOf(
|
||||
"Throwable.kt" to null,
|
||||
"Exceptions.kt" to null,
|
||||
"Exceptions.kt" to null,
|
||||
"Exceptions.kt" to null,
|
||||
"Exceptions.kt" to null,
|
||||
"RuntimeUtils.kt" to null,
|
||||
null,
|
||||
"stack_trace_out_of_bounds.kt" to 7,
|
||||
"stack_trace_out_of_bounds.kt" to 4,
|
||||
null,
|
||||
)
|
||||
internal fun checkFrame(value:String) {
|
||||
val pos = value.split(" ")[0]
|
||||
goldValues[pos.toInt()]?.let{
|
||||
val (pos_, file, line) = regex.find(value)!!.destructured
|
||||
assertEquals(pos_, pos)
|
||||
assertEquals(it.first, file)
|
||||
if (it.second != null) {
|
||||
assertEquals(it.second, line.toInt())
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user