ObjFW  Diff

Differences From Artifact [eb8775f0d6]:

To Artifact [570caa0b7f]:


216
217
218
219
220
221
222
223
224


225
226

227
228
229

230
231

232
233

234
235

236
237
238
239
240
241
242
243
244
245
246
247
248
216
217
218
219
220
221
222


223
224


225

226

227


228


229


230






231
232
233
234
235
236
237







-
-
+
+
-
-
+
-

-
+
-
-
+
-
-
+
-
-
+
-
-
-
-
-
-








	TEST(@"-[indexOfLastOccurrenceOfString:]",
	    [@"π„žΓΆΓΆ" indexOfLastOccurrenceOfString: @"ΓΆΓΆ"] == 1 &&
	    [@"π„žΓΆΓΆ" indexOfLastOccurrenceOfString: @"ΓΆ"] == 2 &&
	    [@"π„žΓΆΓΆ" indexOfLastOccurrenceOfString: @"π„ž"] == 0 &&
	    [@"π„žΓΆΓΆ" indexOfLastOccurrenceOfString: @"x"] == OF_INVALID_INDEX)

	TEST(@"-[substringFromIndexToIndex:]",
	    [[@"π„žΓΆΓΆ" substringFromIndex: 1
	TEST(@"-[substringWithRange:]",
	    [[@"π„žΓΆΓΆ" substringWithRange: of_range(1, 1)] isEqual: @"ΓΆ"] &&
				toIndex: 2] isEqual: @"ΓΆ"] &&
	    [[@"π„žΓΆΓΆ" substringFromIndex: 3
	    [[@"π„žΓΆΓΆ" substringWithRange: of_range(3, 0)] isEqual: @""])
				toIndex: 3] isEqual: @""])

	EXPECT_EXCEPTION(@"Detect out of range in "
	EXPECT_EXCEPTION(@"Detect out of range in -[substringWithRange:] #1",
	    @"-[substringFromIndex:toIndex:] #1", OFOutOfRangeException,
	    [@"π„žΓΆΓΆ" substringFromIndex: 2
	    OFOutOfRangeException, [@"π„žΓΆΓΆ" substringWithRange: of_range(2, 2)])
			       toIndex: 4])
	EXPECT_EXCEPTION(@"Detect out of range in "
	EXPECT_EXCEPTION(@"Detect out of range in -[substringWithRange:] #2",
	    @"-[substringFromIndex:toIndex:] #2", OFOutOfRangeException,
	    [@"π„žΓΆΓΆ" substringFromIndex: 4
	    OFOutOfRangeException, [@"π„žΓΆΓΆ" substringWithRange: of_range(4, 0)])
			       toIndex: 4])

	EXPECT_EXCEPTION(@"Detect start > end in "
	    @"-[substringFromIndex:toIndex:]", OFInvalidArgumentException,
	    [@"π„žΓΆΓΆ" substringFromIndex: 2
			       toIndex: 0])

	TEST(@"-[stringByAppendingString:]",
	    [[@"foo" stringByAppendingString: @"bar"] isEqual: @"foobar"])

	TEST(@"-[stringByPrependingString:]",
	    [[@"foo" stringByPrependingString: @"bar"] isEqual: @"barfoo"])

410
411
412
413
414
415
416
417

418
419

420
421
422

423
424
425
426

427
428

429
430

431
432

433
434

435
436
437
438


439
440
441

442
443
444
445
446
447



448
449
450

451
452

453
454
455
456
457
458

459
460

461
462

463
464
465

466
467

468
469
470
471
472
473
474
475
476
477
478
479
480
399
400
401
402
403
404
405

406
407

408

409

410

411
412

413
414

415


416
417

418


419
420
421


422
423
424
425

426

427
428



429
430
431

432

433


434






435


436
437

438

439

440


441






442
443
444
445
446
447
448







-
+

-
+
-

-
+
-


-
+

-
+
-
-
+

-
+
-
-
+


-
-
+
+


-
+
-


-
-
-
+
+
+
-

-
+
-
-
+
-
-
-
-
-
-
+
-
-
+

-
+
-

-
+
-
-
+
-
-
-
-
-
-








	EXPECT_EXCEPTION(@"Detect invalid encoding in -[stringByURLDecoding] "
	    @"#1", OFInvalidEncodingException, [@"foo%bar" stringByURLDecoding])
	EXPECT_EXCEPTION(@"Detect invalid encoding in -[stringByURLDecoding] "
	    @"#2", OFInvalidEncodingException,
	    [@"foo%FFbar" stringByURLDecoding])

	TEST(@"-[deleteCharactersFromIndex:toIndex:]",
	TEST(@"-[deleteCharactersInRange:]",
	    (s[0] = [OFMutableString stringWithString: @"π„žΓΆΓΆΓΆbÀ€"]) &&
	    R([s[0] deleteCharactersFromIndex: 1
	    R([s[0] deleteCharactersInRange: of_range(1, 3)]) &&
				       toIndex: 4]) &&
	    [s[0] isEqual: @"π„žbÀ€"] &&
	    R([s[0] deleteCharactersFromIndex: 0
	    R([s[0] deleteCharactersInRange: of_range(0, 4)]) &&
				      toIndex: 4]) &&
	    [s[0] isEqual: @""])

	TEST(@"-[replaceCharactersFromIndex:toIndex:withString:]",
	TEST(@"-[replaceCharactersInRange:withString:]",
	    (s[0] = [OFMutableString stringWithString: @"π„žΓΆΓΆΓΆbÀ€"]) &&
		   R([s[0] replaceCharactersFromIndex: 1
	    R([s[0] replaceCharactersInRange: of_range(1, 3)
					      toIndex: 4
					   withString: @"Àâü"]) &&
				  withString: @"Àâü"]) &&
	    [s[0] isEqual: @"π„žΓ€ΓΆΓΌbÀ€"] &&
	    R([s[0] replaceCharactersFromIndex: 0
	    R([s[0] replaceCharactersInRange: of_range(0, 7)
				       toIndex: 7
				    withString: @""]) &&
				  withString: @""]) &&
	    [s[0] isEqual: @""])

	EXPECT_EXCEPTION(@"Detect OoR in "
	    @"-[deleteCharactersFromIndex:toIndex:] #1", OFOutOfRangeException,
	EXPECT_EXCEPTION(@"Detect OoR in -[deleteCharactersInRange:] #1",
	    OFOutOfRangeException,
	    {
		s[0] = [OFMutableString stringWithString: @"π„žΓΆΓΆ"];
		[s[0] deleteCharactersFromIndex: 2
		[s[0] deleteCharactersInRange: of_range(2, 2)];
					toIndex: 4];
	    })

	EXPECT_EXCEPTION(@"Detect OoR in "
	    @"-[deleteCharactersFromIndex:toIndex:] #2", OFOutOfRangeException,
	    [s[0] deleteCharactersFromIndex: 4
	EXPECT_EXCEPTION(@"Detect OoR in -[deleteCharactersInRange:] #2",
	    OFOutOfRangeException,
	    [s[0] deleteCharactersInRange: of_range(4, 0)])
				    toIndex: 4])

	EXPECT_EXCEPTION(@"Detect s > e in "
	EXPECT_EXCEPTION(@"Detect OoR in -[replaceCharactersInRange:withString:] #1",
	    @"-[deleteCharactersFromIndex:toIndex:]",
	    OFInvalidArgumentException,
	    OFOutOfRangeException,
	    [s[0] deleteCharactersFromIndex: 2
				    toIndex: 0])

	EXPECT_EXCEPTION(@"OoR "
	    @"-[replaceCharactersFromIndex:toIndex:withString:] #1",
	    OFOutOfRangeException, [s[0] replaceCharactersFromIndex: 2
	    [s[0] replaceCharactersInRange: of_range(2, 2)
							    toIndex: 4
							 withString: @""])
				withString: @""])

	EXPECT_EXCEPTION(@"OoR "
	EXPECT_EXCEPTION(@"Detect OoR in -[replaceCharactersInRange:withString:] #2",
	    @"-[replaceCharactersFromIndex:toIndex:withString:] #2",
	    OFOutOfRangeException,
	    [s[0] replaceCharactersFromIndex: 4
	    [s[0] replaceCharactersInRange: of_range(4, 0)
				     toIndex: 4
				  withString: @""])
				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"
				    withString: @"foo"]) &&
	    [s[0] isEqual: @"asd foo asd foofoo asd"] &&