XCTAssertEqualObjects crashes comparing arrays of Swift objects.

Originator:tom
Number:rdar://17655159 Date Originated:
Status:Duplicate Resolved:17257148
Product:Developer Tools Product Version:Xcode Version 6.0 (6A254o), OS X 10.9.3 (13D65)
Classification:crash Reproducible:Always
 
Summary:
When using XCTAssertEqualObjects to compare 2 swift arrays, it crashes.

Steps to Reproduce:
Use the following XCTestCase.

import XCTest

class Crash: XCTestCase {

    class Item : Equatable {
        var test: String

        init(_ test: String) {
            self.test = test;
        }
    }

    override func setUp() {
        super.setUp()
        // Put setup code here. This method is called before the invocation of each test method in the class.
    }
    
    override func tearDown() {
        // Put teardown code here. This method is called after the invocation of each test method in the class.
        super.tearDown()
    }

    func testExample() {
        var first = [Item("abc"), Item("def")]
        var second = [Item("abc"), Item("def")]

        XCTAssertEqualObjects(first, second)
    }

}

func == (a: Crash.Item, b: Crash.Item) -> Bool {
    return a.test == b.test
}


Expected Results:
Shouldn’t crash.


Actual Results:
Crashes in [SwiftObject doesNotRecognizeSelector:] (“iPhone 5s”, “iPad Air”, “Resizable iPhone”, “Resizable iPad”).
Or in [SwiftObject retain] (“iPhone 4s”, “iPhone5”, “iPad2”, “iPad Retina”).


Version:
Xcode Version 6.0 (6A254o), OS X 10.9.3 (13D65)

Notes:
* Implementing Equatable on the sub objects doesn’t seem to matter. It was added here for completion.
* This happens for all iOS simulator configurations coming with Xcode6b3. Didn’t manage to get it working on device.
* Haven’t tried on OSX.


Configuration:
Xcode + Simulator

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!