libs-base/Tests/base/NSString/regex.m
theraven a04ed1a9ff Make base do unintuitive and stupid things in the name of Apple compatibility (hopefully Apple will fix their implementation in 10.7.something...).
Fix some tests.



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33687 72102866-910b-0410-8b05-ffd578937521
2011-08-03 09:04:12 +00:00

25 lines
797 B
Objective-C

#import <Foundation/NSString.h>
#import <Foundation/NSRegularExpression.h>
#import "ObjectTesting.h"
int main(void)
{
[NSAutoreleasePool new];
START_SET("NSString + regex")
NS_DURING
[NSRegularExpression new];
NS_HANDLER
SKIP("NSRegularExpression not built, please install libicu")
return 0;
NS_ENDHANDLER
NSString *regex = @"abcd*";
NSString *source = @"abcdddddd e f g";
NSRange r = [source rangeOfString: regex options: NSRegularExpressionSearch];
PASS(r.length == 9, "Correct length for regex, expected 9 got %d", (int)r.length);
regex = @"aBcD*";
r = [source rangeOfString: regex options: (NSRegularExpressionSearch | NSCaseInsensitiveSearch)];
PASS(r.length == 9, "Correct length for regex, expected 9 got %d", (int)r.length);
END_SET("NSString + regex")
return 0;
}