kotlin-test: Make 'todo { }' function common

This commit is contained in:
Ilya Gorbunov
2017-04-19 05:38:45 +03:00
parent 4d0b88e34b
commit f009e0c665
3 changed files with 9 additions and 2 deletions
@@ -0,0 +1,7 @@
package kotlin.test
/**
* 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
*/
header fun todo(block: () -> Unit)
@@ -20,7 +20,7 @@ package kotlin.test
* Comments out a block of test code until it is implemented while keeping a link to the code * 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 * to implement in your unit test output
*/ */
fun todo(block: () -> Any) { impl fun todo(block: () -> Unit) {
// println("TODO at " + (Exception() as java.lang.Throwable).getStackTrace()?.get(1) + " for " + block) // println("TODO at " + (Exception() as java.lang.Throwable).getStackTrace()?.get(1) + " for " + block)
println("TODO at " + block) println("TODO at " + block)
} }
@@ -60,7 +60,7 @@ inline fun <reified T : Throwable> assertFailsWith(message: String? = null, noin
* to implement in your unit test output * to implement in your unit test output
*/ */
@InlineOnly @InlineOnly
inline fun todo(@Suppress("UNUSED_PARAMETER") block: () -> Unit) { impl inline fun todo(@Suppress("UNUSED_PARAMETER") block: () -> Unit) {
System.out.println("TODO at " + currentStackTrace()[0]) System.out.println("TODO at " + currentStackTrace()[0])
} }