Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4671562

Browse files
authored
Fix generating diff for shouldBeEqual (#5065)
<!-- If this PR updates documentation, please update all relevant versions of the docs, see: https://github.com/kotest/kotest/tree/master/documentation/versioned_docs The documentation at https://github.com/kotest/kotest/tree/master/documentation/docs is the documentation for the next minor or major version _TO BE RELEASED_ -->
1 parent 403b231 commit 4671562

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

kotest-assertions/kotest-assertions-core/src/commonMain/kotlin/io/kotest/matchers/equals/shouldEqual.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ fun <A> beEqual(expected: A): Matcher<A> = object : Matcher<A> {
2323
override fun test(value: A) = ComparisonMatcherResult(
2424
passed = value == expected,
2525
expected = expected.print(),
26-
actual = expected.print(),
26+
actual = value.print(),
2727
failureMessageFn = { "$value should be equal to $expected" },
2828
negatedFailureMessageFn = { "$value should not be equal to $expected" })
2929
}

kotest-assertions/kotest-assertions-core/src/jvmTest/kotlin/com/sksamuel/kotest/equals/ShouldBeEqualTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class ShouldBeEqualTest : FunSpec() {
3131
val listA = listOf(1, 2, 3, 4)
3232
val listB = listOf(1, 2, 3)
3333
shouldThrow<AssertionError> { listA shouldBeEqual listB }.message shouldBe """[1, 2, 3, 4] should be equal to [1, 2, 3]
34-
expected:<[1, 2, 3]> but was:<[1, 2, 3]>"""
34+
expected:<[1, 2, 3]> but was:<[1, 2, 3, 4]>"""
3535
}
3636
}
3737
}

0 commit comments

Comments
 (0)