Remove internal visibility suppressions in kotlin.test

Internal visibility works fine in MPP, so they are no longer required.
This commit is contained in:
Ilya Gorbunov
2019-02-10 19:23:46 +03:00
parent fef0cc5d2b
commit 18f9b20610
3 changed files with 3 additions and 7 deletions
@@ -197,7 +197,6 @@ private fun checkFailedAssertion(assertion: () -> Unit) {
assertFailsWith<AssertionError> { withDefaultAsserter(assertion) } assertFailsWith<AssertionError> { withDefaultAsserter(assertion) }
} }
@Suppress("INVISIBLE_MEMBER")
private fun withDefaultAsserter(block: () -> Unit) { private fun withDefaultAsserter(block: () -> Unit) {
val current = overrideAsserter(DefaultAsserter) val current = overrideAsserter(DefaultAsserter)
try { try {
@@ -28,7 +28,6 @@ actual fun todo(block: () -> Unit) {
*/ */
actual fun <T : Throwable> assertFailsWith(exceptionClass: KClass<T>, message: String?, block: () -> Unit): T { actual fun <T : Throwable> assertFailsWith(exceptionClass: KClass<T>, message: String?, block: () -> Unit): T {
val exception = assertFails(message, block) val exception = assertFails(message, block)
@Suppress("INVISIBLE_MEMBER")
assertTrue(exceptionClass.isInstance(exception), messagePrefix(message) + "Expected an exception of $exceptionClass to be thrown, but was $exception") assertTrue(exceptionClass.isInstance(exception), messagePrefix(message) + "Expected an exception of $exceptionClass to be thrown, but was $exception")
@Suppress("UNCHECKED_CAST") @Suppress("UNCHECKED_CAST")
@@ -5,7 +5,6 @@
@file:kotlin.jvm.JvmMultifileClass @file:kotlin.jvm.JvmMultifileClass
@file:kotlin.jvm.JvmName("AssertionsKt") @file:kotlin.jvm.JvmName("AssertionsKt")
@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
package kotlin.test package kotlin.test
@@ -22,11 +21,9 @@ private fun <T : Throwable> assertFailsWithImpl(exceptionClass: Class<T>, messag
return e as T return e as T
} }
@Suppress("INVISIBLE_MEMBER")
asserter.fail(messagePrefix(message) + "Expected an exception of $exceptionClass to be thrown, but was $e") asserter.fail(messagePrefix(message) + "Expected an exception of $exceptionClass to be thrown, but was $e")
} }
@Suppress("INVISIBLE_MEMBER")
val msg = messagePrefix(message) val msg = messagePrefix(message)
asserter.fail(msg + "Expected an exception of $exceptionClass to be thrown, but was completed successfully.") asserter.fail(msg + "Expected an exception of $exceptionClass to be thrown, but was completed successfully.")
} }
@@ -49,6 +46,7 @@ actual fun <T : Throwable> assertFailsWith(exceptionClass: KClass<T>, message: S
* *
* This keeps the code under test referenced, but doesn't actually test it until it is implemented. * This keeps the code under test referenced, but doesn't actually test it until it is implemented.
*/ */
@Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
@InlineOnly @InlineOnly
actual inline fun todo(@Suppress("UNUSED_PARAMETER") block: () -> Unit) { actual inline fun todo(@Suppress("UNUSED_PARAMETER") block: () -> Unit) {
println("TODO at " + currentStackTrace()[0]) println("TODO at " + currentStackTrace()[0])
@@ -59,7 +57,7 @@ actual inline fun todo(@Suppress("UNUSED_PARAMETER") block: () -> Unit) {
* The first element of the array (assuming the array is not empty) represents the top of the * The first element of the array (assuming the array is not empty) represents the top of the
* stack, which is the place where [currentStackTrace] function was called from. * stack, which is the place where [currentStackTrace] function was called from.
*/ */
@Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN") @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
@InlineOnly @InlineOnly
inline fun currentStackTrace() = (java.lang.Exception() as java.lang.Throwable).stackTrace inline fun currentStackTrace() = @Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN") (java.lang.Exception() as java.lang.Throwable).stackTrace