@@ -188,12 +188,11 @@ } - (void)replaceCharactersInRange: (of_range_t)range withString: (OFString *)string { - [_string replaceCharactersInRange: range - withString: string]; + [_string replaceCharactersInRange: range withString: string]; } @end @interface EntityHandler: OFObject @end @@ -273,18 +272,19 @@ TEST(@"-[appendString:] and -[appendUTF8String:]", R([s[1] appendUTF8String: "1𝄞"]) && R([s[1] appendString: @"3"]) && R([s[0] appendString: s[1]]) && [s[0] isEqual: @"täs€1𝄞3"]) TEST(@"-[appendCharacters:length:]", - R([s[1] appendCharacters: ucstr + 6 - length: 2]) && [s[1] isEqual: @"1𝄞3r🀺"]) + R([s[1] appendCharacters: ucstr + 6 length: 2]) && + [s[1] isEqual: @"1𝄞3r🀺"]) TEST(@"-[length]", s[0].length == 7) TEST(@"-[UTF8StringLength]", s[0].UTF8StringLength == 13) TEST(@"-[hash]", s[0].hash == 0x705583C0) - TEST(@"-[characterAtIndex:]", [s[0] characterAtIndex: 0] == 't' && + TEST(@"-[characterAtIndex:]", + [s[0] characterAtIndex: 0] == 't' && [s[0] characterAtIndex: 1] == 0xE4 && [s[0] characterAtIndex: 3] == 0x20AC && [s[0] characterAtIndex: 5] == 0x1D11E) EXPECT_EXCEPTION(@"Detect out of range in -[characterAtIndex:]", @@ -358,12 +358,12 @@ encoding: OF_STRING_ENCODING_ISO_8859_1]) && [is isEqual: @"testäöü"]) #endif TEST(@"-[appendUTFString:length:]", - R([s[0] appendUTF8String: "\xEF\xBB\xBF" "barqux" - length: 6]) && [s[0] isEqual: @"foobar"]) + R([s[0] appendUTF8String: "\xEF\xBB\xBF" "barqux" length: 6]) && + [s[0] isEqual: @"foobar"]) EXPECT_EXCEPTION(@"Detection of invalid UTF-8 encoding #1", OFInvalidEncodingException, [stringClass stringWithUTF8String: "\xE0\x80"]) EXPECT_EXCEPTION(@"Detection of invalid UTF-8 encoding #2", @@ -498,13 +498,11 @@ options: OF_STRING_SEARCH_BACKWARDS].location == OF_NOT_FOUND) EXPECT_EXCEPTION( @"Detect out of range in -[rangeOfString:options:range:]", OFOutOfRangeException, - [C(@"𝄞öö") rangeOfString: @"ö" - options: 0 - range: of_range(3, 1)]) + [C(@"𝄞öö") rangeOfString: @"ö" options: 0 range: of_range(3, 1)]) cs = [OFCharacterSet characterSetWithCharactersInString: @"cđ"]; TEST(@"-[indexOfCharacterFromSet:]", [C(@"abcđabcđe") indexOfCharacterFromSet: cs] == 2 && [C(@"abcđabcđë") @@ -1244,12 +1242,11 @@ [C(@"foo%20bar%22+%24%F0%9F%8D%8C").stringByURLDecoding isEqual: @"foo bar\"+$🍌"]) TEST(@"-[insertString:atIndex:]", (s[0] = [mutableStringClass stringWithString: @"𝄞öööbä€"]) && - R([s[0] insertString: @"äöü" - atIndex: 3]) && + R([s[0] insertString: @"äöü" atIndex: 3]) && [s[0] isEqual: @"𝄞ööäöüöbä€"]) EXPECT_EXCEPTION(@"Detect invalid format in -[stringByURLDecoding] " @"#1", OFInvalidFormatException, [C(@"foo%xbar") stringByURLDecoding]) @@ -1257,22 +1254,17 @@ @"#2", OFInvalidEncodingException, [C(@"foo%FFbar") stringByURLDecoding]) TEST(@"-[setCharacter:atIndex:]", (s[0] = [mutableStringClass stringWithString: @"abäde"]) && - R([s[0] setCharacter: 0xF6 - atIndex: 2]) && + R([s[0] setCharacter: 0xF6 atIndex: 2]) && [s[0] isEqual: @"aböde"] && - R([s[0] setCharacter: 'c' - atIndex: 2]) && + R([s[0] setCharacter: 'c' atIndex: 2]) && [s[0] isEqual: @"abcde"] && - R([s[0] setCharacter: 0x20AC - atIndex: 3]) && + R([s[0] setCharacter: 0x20AC atIndex: 3]) && [s[0] isEqual: @"abc€e"] && - R([s[0] setCharacter: 'x' - atIndex: 1]) && - [s[0] isEqual: @"axc€e"]) + R([s[0] setCharacter: 'x' atIndex: 1]) && [s[0] isEqual: @"axc€e"]) TEST(@"-[deleteCharactersInRange:]", (s[0] = [mutableStringClass stringWithString: @"𝄞öööbä€"]) && R([s[0] deleteCharactersInRange: of_range(1, 3)]) && [s[0] isEqual: @"𝄞bä€"] && @@ -1303,28 +1295,24 @@ [s[0] deleteCharactersInRange: of_range(4, 0)]) EXPECT_EXCEPTION(@"Detect OoR in " @"-[replaceCharactersInRange:withString:] #1", OFOutOfRangeException, - [s[0] replaceCharactersInRange: of_range(2, 2) - withString: @""]) + [s[0] replaceCharactersInRange: of_range(2, 2) withString: @""]) EXPECT_EXCEPTION(@"Detect OoR in " @"-[replaceCharactersInRange:withString:] #2", OFOutOfRangeException, - [s[0] replaceCharactersInRange: of_range(4, 0) - withString: @""]) + [s[0] replaceCharactersInRange: of_range(4, 0) withString: @""]) TEST(@"-[replaceOccurrencesOfString:withString:]", (s[0] = [mutableStringClass stringWithString: @"asd fo asd fofo asd"]) && - R([s[0] replaceOccurrencesOfString: @"fo" - withString: @"foo"]) && + R([s[0] replaceOccurrencesOfString: @"fo" withString: @"foo"]) && [s[0] isEqual: @"asd foo asd foofoo asd"] && (s[0] = [mutableStringClass stringWithString: @"XX"]) && - R([s[0] replaceOccurrencesOfString: @"X" - withString: @"XX"]) && + R([s[0] replaceOccurrencesOfString: @"X" withString: @"XX"]) && [s[0] isEqual: @"XXXX"]) TEST(@"-[replaceOccurrencesOfString:withString:options:range:]", (s[0] = [mutableStringClass stringWithString: @"foofoobarfoobarfoo"]) &&