Skip to content

Commit

Permalink
remove error-level deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
evant committed Dec 5, 2023
1 parent 1034194 commit 82dfd5b
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 108 deletions.
20 changes: 0 additions & 20 deletions assertk/src/commonMain/kotlin/assertk/assert.kt
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
package assertk

import assertk.assertions.isFailure
import assertk.assertions.isSuccess
import assertk.assertions.support.display
import assertk.assertions.support.show
import kotlin.DeprecationLevel.ERROR
import kotlin.reflect.KProperty0
import kotlin.runCatching

/**
* Marks the assertion DSL.
Expand Down Expand Up @@ -175,22 +171,6 @@ fun <T> Assert<T>.all(body: Assert<T>.() -> Unit) {
}
}

/**
* Asserts on the given block returning an `Assert<Result<T>>`. You can test that it returns a value or throws an exception.
*
* ```
* assertThat { 1 + 1 }.isSuccess().isPositive()
*
* assertThat {
* throw Exception("error")
* }.isFailure().hasMessage("error")
* ```
*
* @see assertFailure
*/
@Deprecated("Use assertThat(result) or assertFailure", ReplaceWith("assertThat(runCatching(f))"), ERROR)
inline fun <T> assertThat(f: () -> T): Assert<Result<T>> = assertThat(runCatching(f))

/**
* Runs all assertions in the given lambda and reports any failures.
*/
Expand Down
6 changes: 0 additions & 6 deletions assertk/src/commonMain/kotlin/assertk/failure.kt
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,6 @@ fun fail(error: AssertionError): Nothing {

internal val NONE: Any = Any()

// TODO Delete this before 1.0.
@Deprecated("For binary compatibility", level = HIDDEN)
fun fail(message: String, expected: Any? = NONE, actual: Any? = NONE): Nothing {
fail(message, expected, actual, null)
}

/**
* Fail the test with the given message.
*/
Expand Down
54 changes: 0 additions & 54 deletions assertk/src/commonTest/kotlin/test/assertk/AssertLambdaTest.kt

This file was deleted.

28 changes: 0 additions & 28 deletions assertk/src/jvmMain/kotlin/assertk/assertions/any.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import assertk.all
import assertk.assertions.support.appendName
import assertk.assertions.support.expected
import assertk.assertions.support.show
import java.lang.reflect.InvocationTargetException
import kotlin.reflect.KCallable
import kotlin.reflect.KClass
import kotlin.reflect.KProperty1
import kotlin.reflect.full.IllegalCallableAccessException
Expand Down Expand Up @@ -68,32 +66,6 @@ fun <T : Any> Assert<T>.isNotInstanceOf(jclass: Class<out T>) = given { actual -
expected("to not be instance of:${show(jclass)}")
}

/**
* Returns an assert that asserts on the given property.
* @param callable The function to get the property value out of the value of the current assert. The name of this
* callable will be shown in failure messages.
*
* ```
* assertThat(person).prop(Person::name).isEqualTo("Sue")
* ```
*
* @see prop
*/
@Deprecated(
"Use an overload with explicit name and extract",
ReplaceWith("this.prop(\"NAME\") { callable.call(it) }", "assertk.assertions.prop"),
level = DeprecationLevel.ERROR
)
@Suppress("SwallowedException")
fun <T, P> Assert<T>.prop(callable: KCallable<P>) = prop(callable.name) {
try {
callable.call(it)
} catch (e: InvocationTargetException) {
// unwrap cause for a more helpful error message.
throw e.cause!!
}
}

/**
* Like [isEqualTo] but reports exactly which properties differ. Only supports data classes. Note: you should
* _not_ use this if your data class has a custom [Any.equals] since it can be misleading.
Expand Down

0 comments on commit 82dfd5b

Please sign in to comment.