@@ -181,106 +181,133 @@ public func identityComp(_ element: MinimalComparableValue)
181
181
return element
182
182
}
183
183
184
- public func expectEqual< T : Equatable > ( _ expected: T , _ actual: T ,
184
+ public func expectEqual< T : Equatable > (
185
+ _ first: T ,
186
+ _ second: T ,
185
187
_ message: @autoclosure ( ) -> String = " " ,
186
188
stackTrace: SourceLocStack = SourceLocStack ( ) ,
187
189
showFrame: Bool = true ,
188
- file: String = #file, line: UInt = #line) {
189
- expectEqualTest ( expected, actual, message ( ) ,
190
+ file: String = #file, line: UInt = #line
191
+ ) {
192
+ expectEqualTest ( first, second, message ( ) ,
190
193
stackTrace: stackTrace. pushIf ( showFrame, file: file, line: line) , showFrame: false ) { $0 == $1}
191
194
}
192
195
193
196
public func expectEqual< T : Equatable , U : Equatable > (
194
- _ expected: ( T , U ) , _ actual: ( T , U ) ,
197
+ _ first: ( T , U ) ,
198
+ _ second: ( T , U ) ,
195
199
_ message: @autoclosure ( ) -> String = " " ,
196
200
stackTrace: SourceLocStack = SourceLocStack ( ) ,
197
201
showFrame: Bool = true ,
198
- file: String = #file, line: UInt = #line) {
199
- expectEqualTest ( expected. 0 , actual. 0 , message ( ) ,
202
+ file: String = #file, line: UInt = #line
203
+ ) {
204
+ expectEqualTest ( first. 0 , second. 0 , message ( ) ,
200
205
stackTrace: stackTrace. pushIf ( showFrame, file: file, line: line) , showFrame: false ) { $0 == $1}
201
- expectEqualTest ( expected . 1 , actual . 1 , message ( ) ,
206
+ expectEqualTest ( first . 1 , second . 1 , message ( ) ,
202
207
stackTrace: stackTrace. pushIf ( showFrame, file: file, line: line) , showFrame: false ) { $0 == $1}
203
208
}
204
209
205
210
public func expectEqual< T : Equatable , U : Equatable , V : Equatable > (
206
- _ expected: ( T , U , V ) , _ actual: ( T , U , V ) ,
211
+ _ first: ( T , U , V ) ,
212
+ _ second: ( T , U , V ) ,
207
213
_ message: @autoclosure ( ) -> String = " " ,
208
214
stackTrace: SourceLocStack = SourceLocStack ( ) ,
209
215
showFrame: Bool = true ,
210
- file: String = #file, line: UInt = #line) {
211
- expectEqualTest ( expected. 0 , actual. 0 , message ( ) ,
216
+ file: String = #file, line: UInt = #line
217
+ ) {
218
+ expectEqualTest ( first. 0 , second. 0 , message ( ) ,
212
219
stackTrace: stackTrace. pushIf ( showFrame, file: file, line: line) , showFrame: false ) { $0 == $1}
213
- expectEqualTest ( expected . 1 , actual . 1 , message ( ) ,
220
+ expectEqualTest ( first . 1 , second . 1 , message ( ) ,
214
221
stackTrace: stackTrace. pushIf ( showFrame, file: file, line: line) , showFrame: false ) { $0 == $1}
215
- expectEqualTest ( expected . 2 , actual . 2 , message ( ) ,
222
+ expectEqualTest ( first . 2 , second . 2 , message ( ) ,
216
223
stackTrace: stackTrace. pushIf ( showFrame, file: file, line: line) , showFrame: false ) { $0 == $1}
217
224
}
218
225
219
226
public func expectEqual< T : Equatable , U : Equatable , V : Equatable , W : Equatable > (
220
- _ expected: ( T , U , V , W ) , _ actual: ( T , U , V , W ) ,
227
+ _ first: ( T , U , V , W ) ,
228
+ _ second: ( T , U , V , W ) ,
221
229
_ message: @autoclosure ( ) -> String = " " ,
222
230
stackTrace: SourceLocStack = SourceLocStack ( ) ,
223
231
showFrame: Bool = true ,
224
- file: String = #file, line: UInt = #line) {
225
- expectEqualTest ( expected. 0 , actual. 0 , message ( ) ,
232
+ file: String = #file, line: UInt = #line
233
+ ) {
234
+ expectEqualTest ( first. 0 , second. 0 , message ( ) ,
226
235
stackTrace: stackTrace. pushIf ( showFrame, file: file, line: line) , showFrame: false ) { $0 == $1}
227
- expectEqualTest ( expected . 1 , actual . 1 , message ( ) ,
236
+ expectEqualTest ( first . 1 , second . 1 , message ( ) ,
228
237
stackTrace: stackTrace. pushIf ( showFrame, file: file, line: line) , showFrame: false ) { $0 == $1}
229
- expectEqualTest ( expected . 2 , actual . 2 , message ( ) ,
238
+ expectEqualTest ( first . 2 , second . 2 , message ( ) ,
230
239
stackTrace: stackTrace. pushIf ( showFrame, file: file, line: line) , showFrame: false ) { $0 == $1}
231
- expectEqualTest ( expected . 3 , actual . 3 , message ( ) ,
240
+ expectEqualTest ( first . 3 , second . 3 , message ( ) ,
232
241
stackTrace: stackTrace. pushIf ( showFrame, file: file, line: line) , showFrame: false ) { $0 == $1}
233
242
}
234
243
235
- public func expectEqual( _ expected: String , _ actual: Substring ,
244
+ public func expectEqual(
245
+ _ first: String ,
246
+ _ second: Substring ,
236
247
_ message: @autoclosure ( ) -> String = " " ,
237
248
stackTrace: SourceLocStack = SourceLocStack ( ) ,
238
249
showFrame: Bool = true ,
239
- file: String = #file, line: UInt = #line) {
240
- if !( expected == actual) {
250
+ file: String = #file, line: UInt = #line
251
+ ) {
252
+ if !( first == second) {
241
253
expectationFailure (
242
- " expected: \( String ( reflecting: expected) ) (of type \( String ( reflecting: type ( of: expected) ) ) ) \n "
243
- + " actual: \( String ( reflecting: actual) ) (of type \( String ( reflecting: type ( of: actual) ) ) ) " ,
254
+ """
255
+ first: \( String ( reflecting: first) ) (of type \( String ( reflecting: type ( of: first) ) ) )
256
+ second: \( String ( reflecting: second) ) (of type \( String ( reflecting: type ( of: second) ) ) )
257
+ """ ,
244
258
trace: message ( ) ,
245
259
stackTrace: stackTrace. pushIf ( showFrame, file: file, line: line)
246
260
)
247
261
}
248
262
}
249
- public func expectEqual( _ expected: Substring , _ actual: String ,
263
+ public func expectEqual(
264
+ _ first: Substring ,
265
+ _ second: String ,
250
266
_ message: @autoclosure ( ) -> String = " " ,
251
267
stackTrace: SourceLocStack = SourceLocStack ( ) ,
252
268
showFrame: Bool = true ,
253
- file: String = #file, line: UInt = #line) {
254
- if !( expected == actual) {
269
+ file: String = #file, line: UInt = #line
270
+ ) {
271
+ if !( first == second) {
255
272
expectationFailure (
256
- " expected: \( String ( reflecting: expected) ) (of type \( String ( reflecting: type ( of: expected) ) ) ) \n "
257
- + " actual: \( String ( reflecting: actual) ) (of type \( String ( reflecting: type ( of: actual) ) ) ) " ,
273
+ """
274
+ first: \( String ( reflecting: first) ) (of type \( String ( reflecting: type ( of: first) ) ) )
275
+ second: \( String ( reflecting: second) ) (of type \( String ( reflecting: type ( of: second) ) ) )
276
+ """ ,
258
277
trace: message ( ) ,
259
278
stackTrace: stackTrace. pushIf ( showFrame, file: file, line: line)
260
279
)
261
280
}
262
281
}
263
- public func expectEqual( _ expected: String , _ actual: String ,
282
+ public func expectEqual(
283
+ _ first: String ,
284
+ _ second: String ,
264
285
_ message: @autoclosure ( ) -> String = " " ,
265
286
stackTrace: SourceLocStack = SourceLocStack ( ) ,
266
287
showFrame: Bool = true ,
267
- file: String = #file, line: UInt = #line) {
268
- if !( expected == actual) {
288
+ file: String = #file, line: UInt = #line
289
+ ) {
290
+ if !( first == second) {
269
291
expectationFailure (
270
- " expected: \( String ( reflecting: expected) ) (of type \( String ( reflecting: type ( of: expected) ) ) ) \n "
271
- + " actual: \( String ( reflecting: actual) ) (of type \( String ( reflecting: type ( of: actual) ) ) ) " ,
292
+ """
293
+ first: \( String ( reflecting: first) ) (of type \( String ( reflecting: type ( of: first) ) ) )
294
+ second: \( String ( reflecting: second) ) (of type \( String ( reflecting: type ( of: second) ) ) )
295
+ """ ,
272
296
trace: message ( ) ,
273
297
stackTrace: stackTrace. pushIf ( showFrame, file: file, line: line)
274
298
)
275
299
}
276
300
}
277
301
278
- public func expectEqualReference( _ expected: AnyObject ? , _ actual: AnyObject ? ,
302
+ public func expectEqualReference(
303
+ _ first: AnyObject ? ,
304
+ _ second: AnyObject ? ,
279
305
_ message: @autoclosure ( ) -> String = " " ,
280
306
stackTrace: SourceLocStack = SourceLocStack ( ) ,
281
307
showFrame: Bool = true ,
282
- file: String = #file, line: UInt = #line) {
283
- expectEqualTest ( expected, actual, message ( ) ,
308
+ file: String = #file, line: UInt = #line
309
+ ) {
310
+ expectEqualTest ( first, second, message ( ) ,
284
311
stackTrace: stackTrace. pushIf ( showFrame, file: file, line: line) , showFrame: false ) { $0 === $1}
285
312
}
286
313
@@ -298,61 +325,74 @@ public func expectationFailure(
298
325
// See <rdar://26058520> Generic type constraints incorrectly applied to
299
326
// functions with the same name
300
327
public func expectEqualTest< T> (
301
- _ expected: T , _ actual: T ,
328
+ _ first: T ,
329
+ _ second: T ,
302
330
_ message: @autoclosure ( ) -> String = " " ,
303
331
stackTrace: SourceLocStack = SourceLocStack ( ) ,
304
332
showFrame: Bool = true ,
305
- file: String = #file, line: UInt = #line, sameValue equal: ( T , T ) -> Bool
333
+ file: String = #file, line: UInt = #line,
334
+ sameValue equal: ( T , T ) -> Bool
306
335
) {
307
- if !equal( expected , actual ) {
336
+ if !equal( first , second ) {
308
337
expectationFailure (
309
- " expected: \( String ( reflecting: expected) ) (of type \( String ( reflecting: type ( of: expected) ) ) ) \n "
310
- + " actual: \( String ( reflecting: actual) ) (of type \( String ( reflecting: type ( of: actual) ) ) ) " ,
338
+ """
339
+ first: \( String ( reflecting: first) ) (of type \( String ( reflecting: type ( of: first) ) ) )
340
+ second: \( String ( reflecting: second) ) (of type \( String ( reflecting: type ( of: second) ) ) )
341
+ """ ,
311
342
trace: message ( ) ,
312
343
stackTrace: stackTrace. pushIf ( showFrame, file: file, line: line)
313
344
)
314
345
}
315
346
}
316
347
317
- public func expectNotEqual< T : Equatable > ( _ expected: T , _ actual: T ,
348
+ public func expectNotEqual< T : Equatable > (
349
+ _ first: T ,
350
+ _ second: T ,
318
351
_ message: @autoclosure ( ) -> String = " " ,
319
352
stackTrace: SourceLocStack = SourceLocStack ( ) ,
320
353
showFrame: Bool = true ,
321
- file: String = #file, line: UInt = #line) {
322
- if expected == actual {
354
+ file: String = #file, line: UInt = #line
355
+ ) {
356
+ if first == second {
323
357
expectationFailure (
324
- " unexpected value: \" \( actual ) \" (of type \( String ( reflecting: type ( of: actual ) ) ) ) " ,
358
+ " unexpected value: \" \( second ) \" (of type \( String ( reflecting: type ( of: second ) ) ) ) " ,
325
359
trace: message ( ) ,
326
360
stackTrace: stackTrace. pushIf ( showFrame, file: file, line: line)
327
361
)
328
362
}
329
363
}
330
364
331
365
public func expectOptionalEqual< T> (
332
- _ expected: T , _ actual: T ? ,
366
+ _ first: T ,
367
+ _ second: T ? ,
333
368
_ message: @autoclosure ( ) -> String = " " ,
334
369
stackTrace: SourceLocStack = SourceLocStack ( ) ,
335
370
showFrame: Bool = true ,
336
- file: String = #file, line: UInt = #line, sameValue equal: ( T , T ) -> Bool
371
+ file: String = #file, line: UInt = #line,
372
+ sameValue equal: ( T , T ) -> Bool
337
373
) {
338
- if ( actual == nil ) || !equal( expected , actual !) {
374
+ if ( second == nil ) || !equal( first , second !) {
339
375
expectationFailure (
340
- " expected: \" \( expected) \" (of type \( String ( reflecting: type ( of: expected) ) ) ) \n "
341
- + " actual: \" \( actual. debugDescription) \" (of type \( String ( reflecting: type ( of: actual) ) ) ) " ,
376
+ """
377
+ first: \" \( first) \" (of type \( String ( reflecting: type ( of: first) ) ) )
378
+ second: \" \( second. debugDescription) \" (of type \( String ( reflecting: type ( of: second) ) ) )
379
+ """ ,
342
380
trace: message ( ) ,
343
381
stackTrace: stackTrace. pushIf ( showFrame, file: file, line: line) )
344
382
}
345
383
}
346
384
347
385
public func expectEqual(
348
- _ expected : Any . Type , _ actual : Any . Type ,
386
+ _ first : Any . Type , _ second : Any . Type ,
349
387
_ message: @autoclosure ( ) -> String = " " ,
350
388
stackTrace: SourceLocStack = SourceLocStack ( ) ,
351
389
showFrame: Bool = true ,
352
390
file: String = #file, line: UInt = #line
353
391
) {
354
- expectEqualTest ( expected, actual, message ( ) ,
355
- stackTrace: stackTrace. pushIf ( showFrame, file: file, line: line) , showFrame: false ) { $0 == $1 }
392
+ expectEqualTest (
393
+ first, second, message ( ) ,
394
+ stackTrace: stackTrace. pushIf ( showFrame, file: file, line: line) , showFrame: false
395
+ ) { $0 == $1 }
356
396
}
357
397
358
398
public func expectLT< T : Comparable > ( _ lhs: T , _ rhs: T ,
0 commit comments