diff options
Diffstat (limited to 'UnitTests')
-rw-r--r-- | UnitTests/SPStringAdditionsTest.m | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/UnitTests/SPStringAdditionsTest.m b/UnitTests/SPStringAdditionsTest.m index 208381a8..8fce7e07 100644 --- a/UnitTests/SPStringAdditionsTest.m +++ b/UnitTests/SPStringAdditionsTest.m @@ -26,32 +26,35 @@ #import "SPStringAdditionsTest.h" #import "SPStringAdditions.h" -@implementation SPStringAdditionsTest - -- (void)setUp -{ - -} +static const NSString *SPASCIITestString = @"this is a big, crazy test st'ring with som'e random spaces and quot'es"; +static const NSString *SPUTFTestString = @"In der Kürze liegt die Würz"; -- (void)tearDown -{ - -} +@implementation SPStringAdditionsTest +/** + * stringByRemovingCharactersInSet test case. + */ - (void)testStringByRemovingCharactersInSet { - NSCharacterSet *junk = [NSCharacterSet characterSetWithCharactersInString:@"abc',ü"]; + NSString *charsToRemove = @"abc',ü"; + + NSCharacterSet *junk = [NSCharacterSet characterSetWithCharactersInString:charsToRemove]; - NSString *s = @"this is big, crazy st'ring"; - NSString *expect = @"this is ig rzy string"; + NSString *actualUTFString = SPUTFTestString; + NSString *actualASCIIString = SPASCIITestString; - STAssertEqualObjects([s stringByRemovingCharactersInSet:junk], expect, @"stringByRemovingCharactersInSet"); + NSString *expectedUTFString = @"In der Krze liegt die Wrz"; + NSString *expectedASCIIString = @"this is ig rzy test string with some rndom spes nd quotes"; - // Check UTF - s = @"In der Kürze liegt die Würz"; - expect = @"In der Krze liegt die Wrz"; + STAssertEqualObjects([actualASCIIString stringByRemovingCharactersInSet:junk], + expectedASCIIString, + @"The following characters should have been removed %@", + charsToRemove); - STAssertEqualObjects([s stringByRemovingCharactersInSet:junk], expect, @"stringByRemovingCharactersInSet"); + STAssertEqualObjects([actualUTFString stringByRemovingCharactersInSet:junk], + expectedUTFString, + @"The following characters should have been removed %@", + charsToRemove); } @end |