Remove functions which could conflict with the kotlin.assert function.

This commit is contained in:
Hiram Chirino
2012-03-07 23:58:56 -05:00
parent 75dcb84c2e
commit b8dda416f3
3 changed files with 2 additions and 24 deletions
-11
View File
@@ -16,17 +16,6 @@ private fun locked<T>(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.
*/
+1 -12
View File
@@ -61,23 +61,12 @@ private fun <T> testSuite(builder: TestBuilder<T>, description: TestBuilder<T>.(
fun <T> testSuite(name: String, description: TestBuilder<T>.() -> Unit) : TestSuite? =
testSuite(TestBuilder<T>(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)
}
+1 -1
View File
@@ -25,7 +25,7 @@ public val suite : TestSuite? = testSuite<Int>("test group") {
}
"test 2" - {
assert(state == 31, "message")
assertTrue(state == 31, "message")
println("test '${getName()}': state: $state")
}