@@ -24,34 +24,15 @@ public func equal<T: Equatable>(_ expectedValue: T?) -> Predicate<T> {
24
24
equal ( expectedValue, by: == )
25
25
}
26
26
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
-
42
27
/// A Nimble matcher that succeeds when the actual set is equal to the expected set.
43
28
public func equal< T> ( _ expectedValue: Set < T > ? ) -> Predicate < Set < T > > {
44
29
return equal ( expectedValue, stringify: { stringify ( $0) } )
45
30
}
46
31
47
32
/// A Nimble matcher that succeeds when the actual set is equal to the expected set.
48
33
public 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: < ) } )
55
36
} )
56
37
}
57
38
@@ -118,14 +99,6 @@ public func !=<T: Equatable>(lhs: Expectation<T>, rhs: T?) {
118
99
lhs. toNot ( equal ( rhs) )
119
100
}
120
101
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
-
129
102
public func == < T> ( lhs: Expectation < Set < T > > , rhs: Set < T > ) {
130
103
lhs. to ( equal ( rhs) )
131
104
}
@@ -158,14 +131,6 @@ public func !=<T: Comparable>(lhs: Expectation<Set<T>>, rhs: Set<T>?) {
158
131
lhs. toNot ( equal ( rhs) )
159
132
}
160
133
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
-
169
134
#if canImport(Darwin)
170
135
import class Foundation. NSObject
171
136
0 commit comments