Skip to content

Commit f62b753

Browse files
ansmanevant
authored andcommitted
Add a test case
1 parent dfa3b51 commit f62b753

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package test.assertk
2+
3+
import assertk.assertFailure
4+
import assertk.assertions.hasMessage
5+
import assertk.assertions.isEqualTo
6+
import assertk.assertions.message
7+
import com.willowtreeapps.opentest4k.AssertionFailedError
8+
import kotlinx.coroutines.runBlocking
9+
import test.assertk.assertions.valueOrFail
10+
import kotlin.coroutines.resume
11+
import kotlin.coroutines.suspendCoroutine
12+
import kotlin.test.Test
13+
import kotlin.test.assertEquals
14+
import kotlin.test.assertFailsWith
15+
import kotlin.test.assertFalse
16+
import kotlin.test.assertSame
17+
import kotlin.test.assertTrue
18+
19+
class JVMAssertFailureTest {
20+
@Test
21+
fun can_test_suspending_functions(): Unit = runBlocking {
22+
val t = assertFailsWith<AssertionFailedError> {
23+
assertFailure {
24+
suspendCoroutine { it.resume(Unit) }
25+
}
26+
}
27+
assertEquals("expected failure but lambda completed successfully", t.message)
28+
}
29+
}

0 commit comments

Comments
 (0)