facebook/xctool — pull request #385 by ExtremeMan (2014-07-04 00:35:10+00:00)
Title: Fix duplicated test cases by reloading `isEqual:` and `hash` methods of NSInvocation

By replacing default implementation of `isEqual` and `hash` we could guarantee
that there will be no test duplicates in test suites.

[Based on SenTesting framework implementation of category
NSObject (SenTestRuntimeUtilities) found in NSObject_SenTestRuntimeUtilities.m]
Duplicates appear because SenTesting and XCTest frameworks are recursively
retrieving methods for a particular test case class starting from class itself
and moving to its parent class which could also be a test case with tests. For
each method `NSInvocation` object is created with corresponding `selector`.
If child class implements test with the name which also exists in parent
class then [*TestSuite allTests] returns two test cases with the same name but
the same target which is incorrect.

As it was found in SenTesting framework in NSObject (SenTestRuntimeUtilities)
in method `+ (NSArray *) senAllInstanceInvocations` all invocations are stored
in `NSSet`. Before adding new object `NSSet` checks if the same object is already
added by using `isEqual:` and `hash`. So in this category we are returning `YES`
in `isEqual:` if selectors of both invocations are equal and `hash` based on
string representation of invocation selector.