@@ -135,12 +135,12 @@ @"file://testfile.txt"] encoding: OF_STRING_ENCODING_ISO_8859_1]) && [s[1] isEqual: @"testäöü"]) TEST(@"-[appendCStringWithLength:]", - R([s[0] appendCString: "foobarqux" + 3 - withLength: 3]) && [s[0] isEqual: @"foobar"]) + R([s[0] appendCString: "foo\xEF\xBB\xBF" "barqux" + 3 + withLength: 6]) && [s[0] isEqual: @"foobar"]) EXPECT_EXCEPTION(@"Detection of invalid UTF-8 encoding #1", OFInvalidEncodingException, [OFString stringWithCString: "\xE0\x80"]) EXPECT_EXCEPTION(@"Detection of invalid UTF-8 encoding #2", @@ -402,24 +402,43 @@ EXPECT_EXCEPTION(@"Detect OoR in " @"-[deleteCharactersFromIndex:toIndex:] #1", OFOutOfRangeException, { s[0] = [OFMutableString stringWithString: @"𝄞öö"]; - [s[0] substringFromIndex: 2 - toIndex: 4]; + [s[0] deleteCharactersFromIndex: 2 + toIndex: 4]; }) EXPECT_EXCEPTION(@"Detect OoR in " @"-[deleteCharactersFromIndex:toIndex:] #2", OFOutOfRangeException, - [s[0] substringFromIndex: 4 - toIndex: 4]) + [s[0] deleteCharactersFromIndex: 4 + toIndex: 4]) EXPECT_EXCEPTION(@"Detect s > e in " @"-[deleteCharactersFromIndex:toIndex:]", OFInvalidArgumentException, - [s[0] substringFromIndex: 2 - toIndex: 0]) + [s[0] deleteCharactersFromIndex: 2 + toIndex: 0]) + + EXPECT_EXCEPTION(@"OoR " + @"-[replaceCharactersFromIndex:toIndex:withString:] #1", + OFOutOfRangeException, [s[0] replaceCharactersFromIndex: 2 + toIndex: 4 + withString: @""]) + + EXPECT_EXCEPTION(@"OoR " + @"-[replaceCharactersFromIndex:toIndex:withString:] #2", + OFOutOfRangeException, + [s[0] replaceCharactersFromIndex: 4 + toIndex: 4 + withString: @""]) + + EXPECT_EXCEPTION(@"s>e in " + @"-[replaceCharactersFromIndex:toIndex:withString:]", + OFInvalidArgumentException, [s[0] replaceCharactersFromIndex: 2 + toIndex: 0 + withString: @""]) TEST(@"-[replaceOccurrencesOfString:withString:]", (s[0] = [OFMutableString stringWithString: @"asd fo asd fofo asd"]) && R([s[0] replaceOccurrencesOfString: @"fo"