Skip to content

Commit

Permalink
Improve should & ignore output
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-goral committed May 27, 2020
1 parent c8d5415 commit 0cc3300
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions test_runner/src/test/kotlin/ftl/test/util/TestHelper.kt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@file:Suppress("RemoveCurlyBracesFromTemplate")

package ftl.test.util

import io.mockk.every
Expand Down Expand Up @@ -36,7 +38,7 @@ object TestHelper {
inline fun <reified T : Any> ignore(): T = mockk(relaxed = true) {
val slot = slot<Any>()
every { this@mockk == capture(slot) } answers {
println("match ignored: ${slot.captured}")
println("${this@mockk} match ignored: ${slot.captured}")
true
}
}
Expand All @@ -47,8 +49,8 @@ inline fun <reified T : Any> should(crossinline match: T.() -> Boolean): T = moc
val value = slot.captured
value.match().also { matches ->
if (matches)
println("match success: $value") else
println("match failed: $value")
println("${this@mockk} match succeed: $value") else
println("${this@mockk} match failed: $value")
}
}
}

0 comments on commit 0cc3300

Please sign in to comment.