From b8dda416f3013d3d2fe4bd1527973b0d0443ce42 Mon Sep 17 00:00:00 2001 From: Hiram Chirino Date: Wed, 7 Mar 2012 23:58:56 -0500 Subject: [PATCH] Remove functions which could conflict with the kotlin.assert function. --- examples/example-vfs/src/Utils.kt | 11 ----------- libraries/testlib/test/Test.kt | 13 +------------ libraries/testlib/test/TestDslExample.kt | 2 +- 3 files changed, 2 insertions(+), 24 deletions(-) diff --git a/examples/example-vfs/src/Utils.kt b/examples/example-vfs/src/Utils.kt index 6b8d98efb65..8709d9e17c1 100644 --- a/examples/example-vfs/src/Utils.kt +++ b/examples/example-vfs/src/Utils.kt @@ -16,17 +16,6 @@ private fun locked(lock : Lock, body : () -> T) : T { } } -/** - * Checks boolean value which should be true. If it is false, throws Assertion Error - * - * @param value value to be checked - */ -public fun assert(value : Boolean) { - if (!value) { - throw AssertionError() - } -} - /** * Returns list containing all elements which first contains and second does not. */ diff --git a/libraries/testlib/test/Test.kt b/libraries/testlib/test/Test.kt index f6eade6af77..14913d41086 100644 --- a/libraries/testlib/test/Test.kt +++ b/libraries/testlib/test/Test.kt @@ -61,23 +61,12 @@ private fun testSuite(builder: TestBuilder, description: TestBuilder.( fun testSuite(name: String, description: TestBuilder.() -> Unit) : TestSuite? = testSuite(TestBuilder(name), description) -fun assert(message: String, block: ()-> Boolean) { - val actual = block() - Assert.assertTrue(message, actual) -} - -fun assert(block: ()-> Boolean) = assert(block.toString(), block) - fun assertNot(message: String, block: ()-> Boolean) { - assert(message){ !block() } + Assert.assertTrue(message, block()) } fun assertNot(block: ()-> Boolean) = assertNot(block.toString(), block) -fun assert(actual: Boolean, message: String) { - println("Answer: ${actual} for ${message}") -} - fun assertTrue(actual: Boolean, message: String = "") { return assertEquals(true, actual, message) } diff --git a/libraries/testlib/test/TestDslExample.kt b/libraries/testlib/test/TestDslExample.kt index 4bbdf7bdf7b..536df38528e 100644 --- a/libraries/testlib/test/TestDslExample.kt +++ b/libraries/testlib/test/TestDslExample.kt @@ -25,7 +25,7 @@ public val suite : TestSuite? = testSuite("test group") { } "test 2" - { - assert(state == 31, "message") + assertTrue(state == 31, "message") println("test '${getName()}': state: $state") }