Skip to content

Instantly share code, notes, and snippets.

@HBehrens
Last active December 18, 2015 01:18
Show Gist options
  • Save HBehrens/5702482 to your computer and use it in GitHub Desktop.
Save HBehrens/5702482 to your computer and use it in GitHub Desktop.
NSSelectorFromString nor sel_getUid do return string itself
-(void)testSelectorIdentity {
NSString* stringA = @"someSelector";
NSString* stringB = stringA.mutableCopy;
STAssertTrue(stringA != stringB, @"strings with different identity");
SEL selA = NSSelectorFromString(stringA);
SEL selB = NSSelectorFromString(stringB);
STAssertTrue(selA == selB, @"selectors with same identity (NSSelectorFromString)");
selA = sel_getUid(stringA.UTF8String);
selB = sel_getUid(stringB.UTF8String);
STAssertTrue(selA == selB, @"selectors with same identity (set_getUid)");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment