From 66ce736a81b375c2c47a83889b73446859d1a5bc Mon Sep 17 00:00:00 2001 From: Evgeny Gerashchenko Date: Tue, 29 Jan 2013 20:43:05 +0400 Subject: [PATCH] Moved failsWith to TestJVM. --- libraries/stdlib/src/kotlin/test/Test.kt | 13 ------------- libraries/stdlib/src/kotlin/test/TestJVM.kt | 13 +++++++++++++ 2 files changed, 13 insertions(+), 13 deletions(-) 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