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
This commit is contained in:
theraven 2011-08-03 09:04:12 +00:00
parent 3104649bc8
commit a04ed1a9ff
6 changed files with 34 additions and 76 deletions

View file

@ -1,17 +1,25 @@
#import <Foundation/NSString.h>
#import <Foundation/NSRegularExpression.h>
#import "ObjectTesting.h"
int main(void)
{
NSAutoreleasePool *pool = [NSAutoreleasePool new];
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);
[pool release];
return 0;
[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;
}