ObjFW  Diff

Differences From Artifact [a5554c7700]:

  • File tests/OFStringTests.m — part of check-in [3d16a30f41] at 2013-06-22 12:12:36 on branch trunk — Rework exceptions.

    This mostly removes the argument for the class in which the exception
    occurred. As backtraces were recently added for all platforms, the
    passed class does not give any extra information on where the exception
    occurred anymore.

    This also removes a few other arguments which were not too helpful. In
    the past, the idea was to pass as many arguments as possible so that it
    is easier to find the origin of the exception. However, as backtraces
    are a much better way to find the origin, those are not useful anymore
    and just make the exception more cumbersome to use. The rule is now to
    only pass arguments that might help in recovering from the exception or
    provide information that is otherwise not easily accessible. (user: js, size: 23010) [annotate] [blame] [check-ins using]

To Artifact [fbc369ef09]:

  • File tests/OFStringTests.m — part of check-in [4d892e0db1] at 2013-07-04 20:49:52 on branch trunk — Fix -[replaceCharactersInRange:withString:].

    The resizing is now done before the memmove() if the new string is
    bigger and after the memmove() if the new string is shorter. The added
    comment explains why this is necessary.

    This also adds a test for -[replaceCharactersInRange:withString:] that
    makes the string bigger and another one that makes it smaller again. (user: js, size: 23140) [annotate] [blame] [check-ins using]


477
478
479
480
481
482
483
484



485
486
487
488
489
490
491
	    [s[0] isEqual: @"π„žbÀ€"] &&
	    R([s[0] deleteCharactersInRange: of_range(0, 4)]) &&
	    [s[0] isEqual: @""])

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



	    [s[0] isEqual: @"π„žΓ€ΓΆΓΌbÀ€"] &&
	    R([s[0] replaceCharactersInRange: of_range(0, 7)
				  withString: @""]) &&
	    [s[0] isEqual: @""])

	EXPECT_EXCEPTION(@"Detect OoR in -[deleteCharactersInRange:] #1",
	    OFOutOfRangeException,







|
>
>
>







477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
	    [s[0] isEqual: @"π„žbÀ€"] &&
	    R([s[0] deleteCharactersInRange: of_range(0, 4)]) &&
	    [s[0] isEqual: @""])

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

	EXPECT_EXCEPTION(@"Detect OoR in -[deleteCharactersInRange:] #1",
	    OFOutOfRangeException,