@@ -222,11 +222,11 @@ { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFMutableString *s[3]; OFString *is; OFArray *a; - int i; + size_t i; const of_unichar_t *ua; const uint16_t *u16a; OFCharacterSet *cs; EntityHandler *h; #ifdef OF_HAVE_BLOCKS @@ -604,27 +604,57 @@ ![C(@"foobar") hasSuffix: @"foobar0"]) i = 0; TEST(@"-[componentsSeparatedByString:]", (a = [C(@"fooXXbarXXXXbazXXXX") - componentsSeparatedByString: @"XX"]) && [a count] == 6 && + componentsSeparatedByString: @"XX"]) && [[a objectAtIndex: i++] isEqual: @"foo"] && [[a objectAtIndex: i++] isEqual: @"bar"] && [[a objectAtIndex: i++] isEqual: @""] && [[a objectAtIndex: i++] isEqual: @"baz"] && [[a objectAtIndex: i++] isEqual: @""] && - [[a objectAtIndex: i++] isEqual: @""]) + [[a objectAtIndex: i++] isEqual: @""] && + [a count] == i) i = 0; TEST(@"-[componentsSeparatedByString:options:]", (a = [C(@"fooXXbarXXXXbazXXXX") componentsSeparatedByString: @"XX" options: OF_STRING_SKIP_EMPTY]) && - [a count] == 3 && + [[a objectAtIndex: i++] isEqual: @"foo"] && + [[a objectAtIndex: i++] isEqual: @"bar"] && + [[a objectAtIndex: i++] isEqual: @"baz"] && + [a count] == i) + + cs = [OFCharacterSet characterSetWithCharactersInString: @"XYZ"]; + + i = 0; + TEST(@"-[componentsSeparatedByCharactersInSet:]", + (a = [C(@"fooXYbarXYZXbazXYXZx") + componentsSeparatedByCharactersInSet: cs]) && + [[a objectAtIndex: i++] isEqual: @"foo"] && + [[a objectAtIndex: i++] isEqual: @""] && + [[a objectAtIndex: i++] isEqual: @"bar"] && + [[a objectAtIndex: i++] isEqual: @""] && + [[a objectAtIndex: i++] isEqual: @""] && + [[a objectAtIndex: i++] isEqual: @""] && + [[a objectAtIndex: i++] isEqual: @"baz"] && + [[a objectAtIndex: i++] isEqual: @""] && + [[a objectAtIndex: i++] isEqual: @""] && + [[a objectAtIndex: i++] isEqual: @""] && + [[a objectAtIndex: i++] isEqual: @"x"] && + [a count] == i) + + i = 0; + TEST(@"-[componentsSeparatedByCharactersInSet:options:]", + (a = [C(@"fooXYbarXYZXbazXYXZ") + componentsSeparatedByCharactersInSet: cs + options: OF_STRING_SKIP_EMPTY]) && [[a objectAtIndex: i++] isEqual: @"foo"] && [[a objectAtIndex: i++] isEqual: @"bar"] && - [[a objectAtIndex: i++] isEqual: @"baz"]) + [[a objectAtIndex: i++] isEqual: @"baz"] && + [a count] == i) #ifdef OF_HAVE_FILES # if defined(OF_WINDOWS) || defined(OF_MSDOS) TEST(@"+[pathWithComponents:]", [[stringClass pathWithComponents: [OFArray arrayWithObjects: