Whilst implementing XCTests for NSKeyedUnarchiver, I noticed some issues with equality.
Let’s say I have the following simple Swift program:
let url1 = NSURL(string: "foo.xml", relativeToURL:NSURL(string: "https://www.example.com"))!
let url2 = NSURL(string: "foo.xml", relativeToURL:NSURL(string: "https://www.example.com"))!
print("\(url1 == url2)")
It returns false for both, as opposed to true on OS X Foundation.
NSObject() implements Equatable in terms of isEqual; that’s fine, but apart from __NSCFType the bridged types do not implement isEqual:. It seems that hash, isEqual and description need to be pasted in for the bridged types, à la CF_CLASSIMPLEMENTATION.
I feel though I may be missing something – I would have thought TestFoundation would depend on the equality operator working