ObjFW  Check-in [f977192a23]

Overview
Comment:Get rid of -[*FromIndex:toIndex:].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: f977192a233e204da718f03e7f01b134645c684a13f9e3907ebf6fbc97d6c73e
User & Date: js on 2011-08-04 16:48:32
Other Links: manifest | tags
Context
2011-08-04
17:18
Add a note about usage of super to OFMutableCArray. check-in: dc8b06a5aa user: js tags: trunk
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
Changes

Modified src/OFConstantString.m from [4fa86efffd] to [5745a4d78a].

465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
{
	if (initialized != SIZE_MAX)
		[self finishInitialization];

	return [super containsString: string];
}

- (OFString*)substringFromIndex: (size_t)start
			toIndex: (size_t)end
{
	if (initialized != SIZE_MAX)
		[self finishInitialization];

	return [super substringFromIndex: start
				 toIndex: end];
}

- (OFString*)substringWithRange: (of_range_t)range
{
	if (initialized != SIZE_MAX)
		[self finishInitialization];

	return [super substringWithRange: range];
}







<
<
<
<
<
<
<
<
<
<







465
466
467
468
469
470
471










472
473
474
475
476
477
478
{
	if (initialized != SIZE_MAX)
		[self finishInitialization];

	return [super containsString: string];
}











- (OFString*)substringWithRange: (of_range_t)range
{
	if (initialized != SIZE_MAX)
		[self finishInitialization];

	return [super substringWithRange: range];
}

Modified src/OFHTTPRequest.m from [6cdf31afd0] to [205f214213].

280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
		 */
		line = [sock readLine];
		if (![line hasPrefix: @"HTTP/1.0 "] &&
		    ![line hasPrefix: @"HTTP/1.1 "])
			@throw [OFInvalidServerReplyException
			    newWithClass: isa];

		status = (int)[[line substringFromIndex: 9
						toIndex: 12] decimalValue];

		serverHeaders = [OFMutableDictionary dictionary];

		while ((line = [sock readLine]) != nil) {
			OFString *key, *value;
			const char *line_c = [line cString], *tmp;








|
|







280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
		 */
		line = [sock readLine];
		if (![line hasPrefix: @"HTTP/1.0 "] &&
		    ![line hasPrefix: @"HTTP/1.1 "])
			@throw [OFInvalidServerReplyException
			    newWithClass: isa];

		status = (int)[[line substringWithRange:
		    of_range(9, 3)] decimalValue];

		serverHeaders = [OFMutableDictionary dictionary];

		while ((line = [sock readLine]) != nil) {
			OFString *key, *value;
			const char *line_c = [line cString], *tmp;

Modified src/OFMutableString.h from [903f2cd12d] to [7e1d229b63].

118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
 */
- (void)insertString: (OFString*)string
	     atIndex: (size_t)index;

/**
 * \brief Deletes the characters at the specified range.
 *
 * \param start The index where the deletion should be started
 * \param end The index until which the characters should be deleted.
 *	      This points BEHIND the last character!
 */
- (void)deleteCharactersFromIndex: (size_t)start
			  toIndex: (size_t)end;

/**
 * \brief Deletes the characters at the specified range.
 *
 * \param range The range of the characters which should be removed
 */
- (void)deleteCharactersInRange: (of_range_t)range;

/**
 * \brief Replaces the characters at the specified range.
 *
 * \param start The index where the replacement should be started
 * \param end The index until which the characters should be replaced.
 *	      This points BEHIND the last character!
 * \param replacement The string to the replace the characters with
 */
- (void)replaceCharactersFromIndex: (size_t)start
			   toIndex: (size_t)end
			withString: (OFString*)replacement;

/**
 * \brief Replaces the characters at the specified range.
 *
 * \param range The range of the characters which should be replaced
 * \param replacement The string to the replace the characters with
 */
- (void)replaceCharactersInRange: (of_range_t)range







<
<
<
<
<
<
<
<
<
<




<
<
<
<
<
<
<
<
<
<
<
<







118
119
120
121
122
123
124










125
126
127
128












129
130
131
132
133
134
135
 */
- (void)insertString: (OFString*)string
	     atIndex: (size_t)index;

/**
 * \brief Deletes the characters at the specified range.
 *










 * \param range The range of the characters which should be removed
 */
- (void)deleteCharactersInRange: (of_range_t)range;













/**
 * \brief Replaces the characters at the specified range.
 *
 * \param range The range of the characters which should be replaced
 * \param replacement The string to the replace the characters with
 */
- (void)replaceCharactersInRange: (of_range_t)range

Modified src/OFMutableString.m from [3c8f4c2bc5] to [f5b0d569c9].

429
430
431
432
433
434
435
436

437

438
439
440
441
442
443
444
445
	    string->s->cStringLength);
	s->cString[newCStringLength] = '\0';

	s->cStringLength = newCStringLength;
	s->length += string->s->length;
}

- (void)deleteCharactersFromIndex: (size_t)start

			  toIndex: (size_t)end

{
	if (start > end)
		@throw [OFInvalidArgumentException newWithClass: isa
						       selector: _cmd];

	if (end > s->length)
		@throw [OFOutOfRangeException newWithClass: isa];








|
>
|
>
|







429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
	    string->s->cStringLength);
	s->cString[newCStringLength] = '\0';

	s->cStringLength = newCStringLength;
	s->length += string->s->length;
}

- (void)deleteCharactersInRange: (of_range_t)range
{
	size_t start = range.start;
	size_t end = range.start + range.length;

	if (start > end)
		@throw [OFInvalidArgumentException newWithClass: isa
						       selector: _cmd];

	if (end > s->length)
		@throw [OFOutOfRangeException newWithClass: isa];

461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477


478
479
480
481
482
483
484
					 toSize: s->cStringLength + 1];
	} @catch (OFOutOfMemoryException *e) {
		/* We don't really care, as we only made it smaller */
		[e release];
	}
}

- (void)deleteCharactersInRange: (of_range_t)range
{
	[self deleteCharactersFromIndex: range.start
				toIndex: range.start + range.length];
}

- (void)replaceCharactersFromIndex: (size_t)start
			   toIndex: (size_t)end
			withString: (OFString*)replacement
{


	size_t newCStringLength, newLength;

	if (start > end)
		@throw [OFInvalidArgumentException newWithClass: isa
						       selector: _cmd];

	if (end > s->length)







<
<
<
<
<
<
|
<
|

>
>







463
464
465
466
467
468
469






470

471
472
473
474
475
476
477
478
479
480
481
					 toSize: s->cStringLength + 1];
	} @catch (OFOutOfMemoryException *e) {
		/* We don't really care, as we only made it smaller */
		[e release];
	}
}







- (void)replaceCharactersInRange: (of_range_t)range

		      withString: (OFString*)replacement
{
	size_t start = range.start;
	size_t end = range.start + range.length;
	size_t newCStringLength, newLength;

	if (start > end)
		@throw [OFInvalidArgumentException newWithClass: isa
						       selector: _cmd];

	if (end > s->length)
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
	    replacement->s->cStringLength);
	s->cString[newCStringLength] = '\0';

	s->cStringLength = newCStringLength;
	s->length = newLength;
}

- (void)replaceCharactersInRange: (of_range_t)range
		      withString: (OFString*)replacement
{
	[self replaceCharactersFromIndex: range.start
				 toIndex: range.start + range.length
			      withString: replacement];
}

- (void)replaceOccurrencesOfString: (OFString*)string
			withString: (OFString*)replacement
{
	const char *cString = [string cString];
	const char *replacementCString = [replacement cString];
	size_t cStringLength = string->s->cStringLength;
	size_t replacementCStringLength = replacement->s->cStringLength;







<
<
<
<
<
<
<
<







501
502
503
504
505
506
507








508
509
510
511
512
513
514
	    replacement->s->cStringLength);
	s->cString[newCStringLength] = '\0';

	s->cStringLength = newCStringLength;
	s->length = newLength;
}









- (void)replaceOccurrencesOfString: (OFString*)string
			withString: (OFString*)replacement
{
	const char *cString = [string cString];
	const char *replacementCString = [replacement cString];
	size_t cStringLength = string->s->cStringLength;
	size_t replacementCStringLength = replacement->s->cStringLength;

Modified src/OFString.h from [5a32f0ead2] to [f186440ce9].

570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592

/**
 * \param string The string to search
 * \return Whether the string contains the specified string
 */
- (BOOL)containsString: (OFString*)string;

/**
 * \param start The index where the substring starts
 * \param end The index where the substring ends.
 *	      This points BEHIND the last character!
 * \return The substring as a new autoreleased OFString
 */
- (OFString*)substringFromIndex: (size_t)start
			toIndex: (size_t)end;

/**
 * \param range The range of the substring
 * \return The substring as a new autoreleased OFString
 */
- (OFString*)substringWithRange: (of_range_t)range;

/**







<
<
<
<
<
<
<
<
<







570
571
572
573
574
575
576









577
578
579
580
581
582
583

/**
 * \param string The string to search
 * \return Whether the string contains the specified string
 */
- (BOOL)containsString: (OFString*)string;










/**
 * \param range The range of the substring
 * \return The substring as a new autoreleased OFString
 */
- (OFString*)substringWithRange: (of_range_t)range;

/**

Modified src/OFString.m from [9e62f802e4] to [e16259c02d].

1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406

1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
	for (i = 0; i <= s->cStringLength - cStringLength; i++)
		if (!memcmp(s->cString + i, cString, cStringLength))
			return YES;

	return NO;
}

- (OFString*)substringFromIndex: (size_t)start
			toIndex: (size_t)end
{
	if (start > end)
		@throw [OFInvalidArgumentException newWithClass: isa
						       selector: _cmd];


	if (end > s->length)
		@throw [OFOutOfRangeException newWithClass: isa];

	if (s->isUTF8) {
		start = of_string_index_to_position(s->cString, start,
		    s->cStringLength);
		end = of_string_index_to_position(s->cString, end,
		    s->cStringLength);
	}

	return [OFString stringWithCString: s->cString + start
				    length: end - start];
}

- (OFString*)substringWithRange: (of_range_t)range
{
	return [self substringFromIndex: range.start
				toIndex: range.start + range.length];
}

- (OFString*)stringByAppendingString: (OFString*)string
{
	OFMutableString *new;

	new = [OFMutableString stringWithString: self];
	[new appendString: string];








|
<

|
<
<
>















<
<
<
<
<
<







1394
1395
1396
1397
1398
1399
1400
1401

1402
1403


1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419






1420
1421
1422
1423
1424
1425
1426
	for (i = 0; i <= s->cStringLength - cStringLength; i++)
		if (!memcmp(s->cString + i, cString, cStringLength))
			return YES;

	return NO;
}

- (OFString*)substringWithRange: (of_range_t)range

{
	size_t start = range.start;


	size_t end = range.start + range.length;

	if (end > s->length)
		@throw [OFOutOfRangeException newWithClass: isa];

	if (s->isUTF8) {
		start = of_string_index_to_position(s->cString, start,
		    s->cStringLength);
		end = of_string_index_to_position(s->cString, end,
		    s->cStringLength);
	}

	return [OFString stringWithCString: s->cString + start
				    length: end - start];
}







- (OFString*)stringByAppendingString: (OFString*)string
{
	OFMutableString *new;

	new = [OFMutableString stringWithString: self];
	[new appendString: string];

Modified src/OFXMLParser.m from [b84b15abc4] to [a92b6c9809].

72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
			     withString: @"\n"];
	[ret replaceOccurrencesOfString: @"\r"
			     withString: @"\n"];

	if (cut > 0) {
		size_t length = [ret length];

		[ret deleteCharactersFromIndex: length - cut
				       toIndex: length];
	}

	if (unescape)
		return [ret stringByXMLUnescapingWithDelegate: delegate];

	ret->isa = [OFString class];
	return ret;







|
<







72
73
74
75
76
77
78
79

80
81
82
83
84
85
86
			     withString: @"\n"];
	[ret replaceOccurrencesOfString: @"\r"
			     withString: @"\n"];

	if (cut > 0) {
		size_t length = [ret length];

		[ret deleteCharactersInRange: of_range(length - cut, cut)];

	}

	if (unescape)
		return [ret stringByXMLUnescapingWithDelegate: delegate];

	ret->isa = [OFString class];
	return ret;
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
	char piDelimiter = 0;

	if (!acceptProlog)
		return NO;

	acceptProlog = NO;

	pi = [pi substringFromIndex: 3
			    toIndex: [pi length]];
	pi = [pi stringByDeletingEnclosingWhitespaces];

	cString = [pi cString];
	length = [pi cStringLength];

	for (i = last = 0; i < length; i++) {
		switch (piState) {







|
<







394
395
396
397
398
399
400
401

402
403
404
405
406
407
408
	char piDelimiter = 0;

	if (!acceptProlog)
		return NO;

	acceptProlog = NO;

	pi = [pi substringWithRange: of_range(3, [pi length] - 3)];

	pi = [pi stringByDeletingEnclosingWhitespaces];

	cString = [pi cString];
	length = [pi cStringLength];

	for (i = last = 0; i < length; i++) {
		switch (piState) {

Modified tests/OFStringTests.m from [eb8775f0d6] to [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

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

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

	EXPECT_EXCEPTION(@"Detect out of range in "
	    @"-[substringFromIndex:toIndex:] #1", OFOutOfRangeException,
	    [@"π„žΓΆΓΆ" substringFromIndex: 2
			       toIndex: 4])
	EXPECT_EXCEPTION(@"Detect out of range in "
	    @"-[substringFromIndex:toIndex:] #2", OFOutOfRangeException,
	    [@"π„žΓΆΓΆ" substringFromIndex: 4
			       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"])








|
|
<
|
<

|
<
|
<
|
<
|
<
<
<
<
<
<







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(@"-[substringWithRange:]",
	    [[@"π„žΓΆΓΆ" substringWithRange: of_range(1, 1)] isEqual: @"ΓΆ"] &&

	    [[@"π„žΓΆΓΆ" substringWithRange: of_range(3, 0)] isEqual: @""])


	EXPECT_EXCEPTION(@"Detect out of range in -[substringWithRange:] #1",

	    OFOutOfRangeException, [@"π„žΓΆΓΆ" substringWithRange: of_range(2, 2)])

	EXPECT_EXCEPTION(@"Detect out of range in -[substringWithRange:] #2",

	    OFOutOfRangeException, [@"π„žΓΆΓΆ" substringWithRange: of_range(4, 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

	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:]",
	    (s[0] = [OFMutableString stringWithString: @"π„žΓΆΓΆΓΆbÀ€"]) &&
	    R([s[0] deleteCharactersFromIndex: 1
				       toIndex: 4]) &&
	    [s[0] isEqual: @"π„žbÀ€"] &&
	    R([s[0] deleteCharactersFromIndex: 0
				      toIndex: 4]) &&
	    [s[0] isEqual: @""])

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







|

|
<

|
<


|

|
<
|

|
<
|


|
|


|
<


|
|
|
<

|
<
|
<
<
<
<
<
|
<
|

|
<

|
<
|
<
<
<
<
<
<







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(@"-[deleteCharactersInRange:]",
	    (s[0] = [OFMutableString stringWithString: @"π„žΓΆΓΆΓΆbÀ€"]) &&
	    R([s[0] deleteCharactersInRange: of_range(1, 3)]) &&

	    [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,
	    {
		s[0] = [OFMutableString stringWithString: @"π„žΓΆΓΆ"];
		[s[0] deleteCharactersInRange: of_range(2, 2)];

	    })

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


	EXPECT_EXCEPTION(@"Detect OoR in -[replaceCharactersInRange:withString:] #1",

	    OFOutOfRangeException,





	    [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: @""])







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