aboutsummaryrefslogtreecommitdiffstats
path: root/UnitTests/SPStringAdditionsTest.m
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2011-01-09 14:12:54 +0000
committerstuconnolly <stuart02@gmail.com>2011-01-09 14:12:54 +0000
commit903e0be357aacd86d7f27b73cd343e8fc8828b88 (patch)
tree4ca88362d16cbd76f58080d15d77c4ec1379688b /UnitTests/SPStringAdditionsTest.m
parentfd57610b1f3c8e1922b022b7ce6d5f31b6dd1207 (diff)
downloadsequelpro-903e0be357aacd86d7f27b73cd343e8fc8828b88.tar.gz
sequelpro-903e0be357aacd86d7f27b73cd343e8fc8828b88.tar.bz2
sequelpro-903e0be357aacd86d7f27b73cd343e8fc8828b88.zip
More tests tidy up.
Diffstat (limited to 'UnitTests/SPStringAdditionsTest.m')
-rw-r--r--UnitTests/SPStringAdditionsTest.m39
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