[PowerAssert] Add codegen tests
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
package infix.dispatch
|
||||
|
||||
class Wrapper<V>(
|
||||
private val value: V,
|
||||
) {
|
||||
infix fun mustEqual(expected: V): Unit = assert(value == expected)
|
||||
|
||||
fun mustEqual(expected: V, message: () -> String): Unit =
|
||||
assert(value == expected, message)
|
||||
|
||||
override fun toString() = "Wrapper"
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package infix.extension
|
||||
|
||||
infix fun <V> V.mustEqual(expected: V): Unit = assert(this == expected)
|
||||
fun <V> V.mustEqual(expected: V, message: () -> String): Unit =
|
||||
assert(this == expected, message)
|
||||
@@ -0,0 +1,8 @@
|
||||
fun expectThrowableMessage(block: () -> Unit): String {
|
||||
try {
|
||||
block()
|
||||
throw AssertionError("no failure")
|
||||
} catch (e: Throwable) {
|
||||
return e.message ?: throw AssertionError("no message")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user