@@ -24,34 +24,15 @@ public func equal<T: Equatable>(_ expectedValue: T?) -> Predicate<T> {
2424 equal ( expectedValue, by: == )
2525}
2626
27- /// A Nimble matcher allowing comparison of collection with optional type
28- public func equal< T: Equatable > ( _ expectedValue: [ T ? ] ) -> Predicate < [ T ? ] > {
29- return Predicate . define ( " equal < \( stringify ( expectedValue) ) > " ) { actualExpression, msg in
30- guard let actualValue = try actualExpression. evaluate ( ) else {
31- return PredicateResult (
32- status: . fail,
33- message: msg. appendedBeNilHint ( )
34- )
35- }
36-
37- let matches = expectedValue == actualValue
38- return PredicateResult ( bool: matches, message: msg)
39- }
40- }
41-
4227/// A Nimble matcher that succeeds when the actual set is equal to the expected set.
4328public func equal< T> ( _ expectedValue: Set < T > ? ) -> Predicate < Set < T > > {
4429 return equal ( expectedValue, stringify: { stringify ( $0) } )
4530}
4631
4732/// A Nimble matcher that succeeds when the actual set is equal to the expected set.
4833public func equal< T: Comparable > ( _ expectedValue: Set < T > ? ) -> Predicate < Set < T > > {
49- return equal ( expectedValue, stringify: {
50- if let set = $0 {
51- return stringify ( Array ( set) . sorted { $0 < $1 } )
52- } else {
53- return " nil "
54- }
34+ return equal ( expectedValue, stringify: { set in
35+ stringify ( set. map { Array ( $0) . sorted ( by: < ) } )
5536 } )
5637}
5738
@@ -118,14 +99,6 @@ public func !=<T: Equatable>(lhs: Expectation<T>, rhs: T?) {
11899 lhs. toNot ( equal ( rhs) )
119100}
120101
121- public func == < T: Equatable > ( lhs: Expectation < [ T ] > , rhs: [ T ] ? ) {
122- lhs. to ( equal ( rhs) )
123- }
124-
125- public func != < T: Equatable > ( lhs: Expectation < [ T ] > , rhs: [ T ] ? ) {
126- lhs. toNot ( equal ( rhs) )
127- }
128-
129102public func == < T> ( lhs: Expectation < Set < T > > , rhs: Set < T > ) {
130103 lhs. to ( equal ( rhs) )
131104}
@@ -158,14 +131,6 @@ public func !=<T: Comparable>(lhs: Expectation<Set<T>>, rhs: Set<T>?) {
158131 lhs. toNot ( equal ( rhs) )
159132}
160133
161- public func == < T, C: Equatable > ( lhs: Expectation < [ T : C ] > , rhs: [ T : C ] ? ) {
162- lhs. to ( equal ( rhs) )
163- }
164-
165- public func != < T, C: Equatable > ( lhs: Expectation < [ T : C ] > , rhs: [ T : C ] ? ) {
166- lhs. toNot ( equal ( rhs) )
167- }
168-
169134#if canImport(Darwin)
170135import class Foundation. NSObject
171136
0 commit comments