You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you debug a spek test and your class contains a function named "advance()" this method will be called when stepping over function calls in the debugger.
How to reproduce:
Set breakpoint on advance() function call in the for loop
Debug spek test via debug functionality
When the debugger stops you at the breakpoint just hit "F8" to step over all the function calls, for each time you step over a function, advance() will be called an the counter will increase. But this only happens if the debugger view in IntelliJ is visible (the one where you can inspect the stack frames), if you switch to console view during debugging this issue does not occur.
assertion will fail
So far I have found out that the issue has to do with the actual function definition, if I rename the function to something else this is not reproducible.
import org.jetbrains.spek.api.dsl.given
import org.jetbrains.spek.api.dsl.it
import org.jetbrains.spek.api.dsl.on
import org.junit.Assert.assertEquals
class CounterTest {
var counter: Int = 0
fun count(): Int {
println("Counter initial count: " + counter)
for (i in 1..10) {
advance()
println("Current loop iteration count : " + counter)
}
return counter
}
private fun advance() {
counter++
}
}
fun main(args: Array<String>) {
val counter = CounterTest()
val finalCount = counter.count()
assertEquals(10, finalCount)
}
object CounterSpek : Spek({
given("counter") {
on("do count to 10") {
val counter = CounterTest()
val finalCount = counter.count()
it("expected final count is 10") {
assertEquals(10, finalCount)
}
}
}
})
The text was updated successfully, but these errors were encountered:
When you debug a spek test and your class contains a function named "advance()" this method will be called when stepping over function calls in the debugger.
How to reproduce:
So far I have found out that the issue has to do with the actual function definition, if I rename the function to something else this is not reproducible.
The text was updated successfully, but these errors were encountered: