Clean up NSRegularExpression, so that it compiles without warnings with or without ICU, but we don't pretend that we support things that we don't and silently return nonsense results to make debugging difficult for GNUstep users.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33688 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
David Chisnall 2011-08-03 12:04:27 +00:00
parent 682c9beb5b
commit fa6f119996
4 changed files with 60 additions and 68 deletions

View file

@ -1,18 +1,13 @@
#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
#if !(__APPLE__ || GS_USE_ICU)
SKIP("NSRegularExpression not built, please install libicu")
return 0;
NS_ENDHANDLER
#else
NSString *regex = @"abcd*";
NSString *source = @"abcdddddd e f g";
NSRange r = [source rangeOfString: regex options: NSRegularExpressionSearch];
@ -20,6 +15,7 @@ int main(void)
regex = @"aBcD*";
r = [source rangeOfString: regex options: (NSRegularExpressionSearch | NSCaseInsensitiveSearch)];
PASS(r.length == 9, "Correct length for regex, expected 9 got %d", (int)r.length);
#endif
END_SET("NSString + regex")
return 0;
}