-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Description
Description
Hello,
i found a strange issue while playing around with the testing library.
I will provide some more context later, but the reproduction is very simple: compare two objects in #expect, if the condition is false there is a crash, if the condition is true everything is ok.
I made a test with various samples but the ones causing an issue seem to be related to enums with generic.
In the reproduction examples below the difference is that .playerStandUp are enums without generics and it works, and .roundEnded is an enum with generics and it fails.
That's the only difference that i see for now.
Expected behavior
Test fails providing some details about unfulfilled expectation
Actual behavior
Test crashes with a EXC_BAD_ACCESS (code=1, address=0x10)
Steps to reproduce
Run the test in the latest xcode
@Test("Why are you crashing")
func whyAreYouCrashing() async throws {
#expect(.roundEnded(
board: GenericBoard,
winningSides: [Blacks],
reason:.agreedDraw
) == .roundEnded(
board: GenericBoard,
winningSides: [Blacks],
reason:.abandon
))
}
But this one works (failed expectation as it should be)
@Test("Why do you work then")
func whyDoYouWorkThen() async throws {
#expect(.playerStandUp(
attendees: Attendees(
players: [:],
observers: []
),
playerId: "id-wrong",
side: Whites
) == .playerStandUp(
attendees: Attendees(
players: [:],
observers: []
),
playerId: "id-correct",
side: Whites
))
}
swift-testing version/commit hash
Swift & OS version (output of swift --version ; uname -a
)
swift-driver version: 1.115 Apple Swift version 6.0 (swiftlang-6.0.0.9.10 clang-1600.0.26.2)
No response