File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed
jvmTest/kotlin/test/assertk/assertions Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,6 @@ package assertk
10
10
* }
11
11
* ```
12
12
*/
13
- fun assume (f : () -> Unit ) {
13
+ inline fun assume (f : () -> Unit ) {
14
14
AssumptionFailure .run { f() }
15
15
}
Original file line number Diff line number Diff line change 1
1
package test.assertk.assertions
2
2
3
3
import assertk.assertThat
4
+ import assertk.assertions.isEqualTo
4
5
import assertk.assertions.isFalse
6
+ import assertk.assertions.isTrue
5
7
import assertk.assume
6
8
import com.willowtreeapps.opentest4k.TestAbortedException
9
+ import test.assertk.runTest
7
10
import kotlin.test.Test
8
11
import kotlin.test.assertEquals
9
12
import kotlin.test.assertFailsWith
@@ -25,4 +28,16 @@ class AssumeTest {
25
28
// this test should be skipped instead of failing
26
29
assume { assertThat(true ).isFalse() }
27
30
}
31
+
32
+ @Test
33
+ fun assume_does_not_capture_unexpected_exceptions () {
34
+ assertFailsWith<NullPointerException > {
35
+ assume { throw NullPointerException () }
36
+ }
37
+ }
38
+
39
+ @Test
40
+ fun assume_aborts_when_suspend () = runTest {
41
+ assume { assertThat(suspend { true }()).isFalse() }
42
+ }
28
43
}
You can’t perform that action at this time.
0 commit comments