XCTAssertEqual has compiler error where XCTAssertEqualObjects did not for Swift Arrays

Originator:bj.miller.ltd
Number:rdar://17827267 Date Originated:July 28, 2014
Status:Open Resolved:
Product:Swift Product Version:Xcode 6b4
Classification: Reproducible:Always
 
Summary:Xcode 6 beta 4 removed XCTAssertEqualObjects in favor of just XCTAssertEqual for any value or object. Xcode now has a compiler error when trying to assert that arrays should be equal, even if they are two empty arrays (such as XCTAssertEqual([Int](), [Int](), ...).

Steps to Reproduce:
1. Create a subclass of XCTestCase in Swift
2. Create a test function to test equality of two arrays, using XCTAssertEqual(firstArray, secondArray, message)
2a. Or, create a test function to test equality of two arrays, using XCTAssert(firstArray == secondArray, message)
3. Receive compile error. 

Expected Results:Expect two empty arrays to be equal (not === equal, but just == equal).

Actual Results:Compiler error: "Type [Type] does not conform to protocol 'Equatable'.", where T could be Int, or even (in the included project) the Question class. This example is derived from Graham Lee's book "Test-Driven iOS Development". Note: This example worked in Xcode beta 3 with XCTAssertEqualObjects(firstArray, secondArray, message).

Version:Xcode 6 beta 4 (6A267n). Mac OS X 10.9.4 (13E28).

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!