diff --git a/libraries/stdlib/src/kotlin/test/Test.kt b/libraries/stdlib/src/kotlin/test/Test.kt index 9880f1045ba..f26d0929885 100644 --- a/libraries/stdlib/src/kotlin/test/Test.kt +++ b/libraries/stdlib/src/kotlin/test/Test.kt @@ -85,19 +85,6 @@ public fun fails(block: ()-> Unit): Throwable? { } } -/** Asserts that a block fails with a specific exception being thrown */ -public fun failsWith(block: ()-> Any): T { - try { - block() - asserter.fail("Expected an exception to be thrown") - throw IllegalStateException("Should have failed") - } catch (e: T) { - //println("Caught expected exception: $e") - // OK - return e - } -} - /** * A plugin for performing assertions which can reuse JUnit or TestNG */ diff --git a/libraries/stdlib/src/kotlin/test/TestJVM.kt b/libraries/stdlib/src/kotlin/test/TestJVM.kt index 1bfa217648f..484938966a9 100644 --- a/libraries/stdlib/src/kotlin/test/TestJVM.kt +++ b/libraries/stdlib/src/kotlin/test/TestJVM.kt @@ -2,6 +2,19 @@ package kotlin.test import java.util.ServiceLoader +/** Asserts that a block fails with a specific exception being thrown */ +public fun failsWith(block: ()-> Any): T { + try { + block() + asserter.fail("Expected an exception to be thrown") + throw IllegalStateException("Should have failed") + } catch (e: T) { + //println("Caught expected exception: $e") + // OK + return e + } +} + /** * Comments out a block of test code until it is implemented while keeping a link to the code * to implement in your unit test output