Permalink
Browse files

adding cw_isNotEmptyString to NSString and a unit test for it

  • Loading branch information...
1 parent a2b1f83 commit 7650c2ec8704ac0a1ca076fec981c67ad8ec1ebe @Machx committed Jan 5, 2011
Showing with 17 additions and 0 deletions.
  1. +7 −0 Source/CWNSStringTests.m
  2. +2 −0 Source/NSStringAdditions.h
  3. +8 −0 Source/NSStringAdditions.m
@@ -19,4 +19,11 @@ -(void)testUUIDStrings
STAssertTrue((![string1 isEqualToString:string2]),@"String 1 and String shouldn't be the same");
}
+-(void)testEmptyStringMethod
+{
+ NSString *emptyString1 = @"";
+
+ STAssertTrue(![emptyString1 cw_isNotEmptyString],@"String1 should be empty");
+}
+
@end
@@ -17,4 +17,6 @@
- (NSString *) cw_stringByAddingPercentEscapesUsingEncoding: (NSStringEncoding) encoding legalURLCharactersToBeEscaped: (NSString *) legalCharacters;
- (NSString *) cw_stringByReplacingPercentEscapes;
+- (BOOL) cw_isNotEmptyString;
+
@end
@@ -93,4 +93,12 @@ - (NSString *) cw_stringByReplacingPercentEscapes
return returnString;
}
+/**
+ Quick test for an empty string
+ */
+- (BOOL) cw_isNotEmptyString
+{
+ return ![self isEqualToString:@""];
+}
+
@end

0 comments on commit 7650c2e

Please sign in to comment.