Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

46 lines (33 sloc) 1.554 kB
//
// Licensed under the terms in License.txt
//
// Copyright 2010 Allen Ding. All rights reserved.
//
#import "Kiwi.h"
#import "KiwiTestConfiguration.h"
#if KW_TESTS_ENABLED
@interface KWStringUtilitiesTest : SenTestCase
@end
@implementation KWStringUtilitiesTest
- (void)testItShouldDetectStringsWithStrictWordPrefixes {
NSString *string = @"KWEqualMatcher";
NSString *prefix = @"KW";
STAssertTrue(KWStringHasStrictWordPrefix(string, prefix), @"expected string to pass test");
string = @"KWarElephant";
STAssertFalse(KWStringHasStrictWordPrefix(string, prefix), @"expected string to fail test");
string = @"itShouldOpenDoors";
prefix = @"it";
STAssertTrue(KWStringHasStrictWordPrefix(string, prefix), @"expected string to pass test");
string = @"itsyBitsy";
STAssertFalse(KWStringHasStrictWordPrefix(string, prefix), @"expected string to fail test");
}
- (void)testItShouldDetectStringsWithWords {
STAssertTrue(KWStringHasWord(@"copy", @"copy"), @"expected string to pass test");
STAssertTrue(KWStringHasWord(@"mutableCopy", @"Copy"), @"expected string to pass test");
STAssertTrue(KWStringHasWord(@"mutableCopyWithAccoutrement", @"Copy"), @"expected string to pass test");
STAssertFalse(KWStringHasWord(@"copyright", @"copy"), @"expected string to pass test");
STAssertFalse(KWStringHasWord(@"rightcopy", @"copy"), @"expected string to pass test");
STAssertFalse(KWStringHasWord(@"copyright", @"copy"), @"expected string to pass test");
}
@end
#endif // #if KW_TESTS_ENABLED
Jump to Line
Something went wrong with that request. Please try again.