ObjFW  Check-in [cc93f51348]

Overview
Comment:Fix a few OFString tests.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: cc93f5134800f68e2ba5953fc30fbd5dd24c4ccc91d4d100b42181c45e341842
User & Date: js on 2011-08-03 16:25:57
Other Links: manifest | tags
Context
2011-08-04
16:48
Get rid of -[*FromIndex:toIndex:]. check-in: f977192a23 user: js tags: trunk
2011-08-03
16:25
Fix a few OFString tests. check-in: cc93f51348 user: js tags: trunk
04:14
Use the well hidden __objc_update_dispatch_table_for_class() function. check-in: 3f0940e36d user: js tags: trunk
Changes

Modified tests/OFStringTests.m from [5ba4a302f9] to [eb8775f0d6].

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
				    withString: @""]) &&
	    [s[0] isEqual: @""])

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

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

	EXPECT_EXCEPTION(@"Detect s > e in "
	    @"-[deleteCharactersFromIndex:toIndex:]",
	    OFInvalidArgumentException,
	    [s[0] substringFromIndex: 2
			     toIndex: 0])




















	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"] &&







|
|




|
|




|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







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
				    withString: @""]) &&
	    [s[0] isEqual: @""])

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

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

	EXPECT_EXCEPTION(@"Detect s > e in "
	    @"-[deleteCharactersFromIndex:toIndex:]",
	    OFInvalidArgumentException,
	    [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"
				    withString: @"foo"]) &&
	    [s[0] isEqual: @"asd foo asd foofoo asd"] &&