Quick / Nimble

A Matcher Framework for Swift and Objective-C
https://quick.github.io/Nimble/documentation/nimble/
Apache License 2.0
4.8k stars 596 forks source link

Equal predicate for array of tuples #1065

Closed faroman closed 1 year ago

faroman commented 1 year ago

Added ability to check an array of tuples for equivalence. Nimble provides such API for tuples, but not for arrays of tuples. The new feature was implemented by copy-pasting the Equal+Tuple.swift file with the necessary adjustments.

Unfortunately, there is a lot of duplicated code in the tests, but I can't get rid of it :(

younata commented 1 year ago

I love this. It's great.

I do wonder if maybe it would be better to do this using type parameter packs? (And similarly, go back to the equal+tuples and reimplement it using type parameter packs - which would be an entirely separate PR).

OTOH, as written, this will support earlier versions of Swift.

faroman commented 1 year ago

Looks like type parameter packs is useless in this case :(\ I've installed Xcode 15 and tried to rewrite equal function for tuples and arrays of tuple, but got no results. Maybe I don't understand how to implement it in a proper way. Please look in the attached files, maybe you will find a reason why they cannot not be compiled.\ \ Also I fixed swiftlint issues

Archive.zip

younata commented 1 year ago

Looks like type parameter packs is useless in this case :( I've installed Xcode 15 and tried to rewrite equal function for tuples and arrays of tuple, but got no results. Maybe I don't understand how to implement it in a proper way. Please look in the attached files, maybe you will find a reason why they cannot not be compiled.

Bummer. I'll look into redoing this to use parameter packs (if possible) at a later date. For now, this is good and I don't see any reason to block it any more than I have. Thanks for your contribution!

Also I fixed swiftlint issues.

Thanks!

faroman commented 1 year ago

Thanks!

🤝