Skip to content

Commit

Permalink
tidy up kotest matchers
Browse files Browse the repository at this point in the history
  • Loading branch information
dkandalov committed Nov 20, 2023
1 parent 9948f09 commit e04a786
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,18 @@ infix fun <E> Result<*, E>.shouldBeFailure(block: (E) -> Unit) {
infix fun <E> Result<*, E>.shouldBeFailure(expected: E) =
this should beFailure(expected)

private fun <T, E> Result<T, E>.matchesValue(value: Result<T, E>): MatcherResult =
private fun <T, E> Result<T, E>.matchesValue(actual: Result<T, E>): MatcherResult =
matcherResultWithIntelliJDiff(
passed = value == this,
actual = toString(),
expected = value.toString()
passed = this == actual,
actual = this.toString(),
expected = actual.toString()
)

private fun <T, E, C : Result<T, E>> Result<T, E>.matchesType(resultClass: KClass<C>): MatcherResult =
private fun <T, E, C : Result<T, E>> Result<T, E>.matchesType(expected: KClass<C>): MatcherResult =
matcherResultWithIntelliJDiff(
passed = resultClass.isInstance(this),
passed = expected.isInstance(this),
actual = this.toString(),
expected = resultClass.simpleName!!
expected = expected.simpleName!!
)

/**
Expand Down

0 comments on commit e04a786

Please sign in to comment.