ObjFW  Diff

Differences From Artifact [ea65aa5e42]:

To Artifact [75808adfc5]:


14
15
16
17
18
19
20


21
22
23
24
25
26
27
 * file.
 */

#include "config.h"

#import "OFArray.h"
#import "OFString.h"


#import "OFAutoreleasePool.h"

#import "OFEnumerationMutationException.h"
#import "OFOutOfRangeException.h"

#import "TestsAppDelegate.h"








>
>







14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
 * file.
 */

#include "config.h"

#import "OFArray.h"
#import "OFString.h"
#import "OFNumber.h"
#import "OFURL.h"
#import "OFAutoreleasePool.h"

#import "OFEnumerationMutationException.h"
#import "OFOutOfRangeException.h"

#import "TestsAppDelegate.h"

291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
		case 1:
			return @"bar";
		}

		return nil;
		}]) && [[m[0] description] isEqual: @"(\n\tfoo,\n\tbar\n)"])

	TEST(@"-[mappedArrayUsingBLock]",
	    [[[m[0] mappedArrayUsingBlock: ^ id (id obj, size_t idx) {
		switch (idx) {
		case 0:
			return @"foobar";
		case 1:
			return @"qux";
		}







|







293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
		case 1:
			return @"bar";
		}

		return nil;
		}]) && [[m[0] description] isEqual: @"(\n\tfoo,\n\tbar\n)"])

	TEST(@"-[mappedArrayUsingBlock:]",
	    [[[m[0] mappedArrayUsingBlock: ^ id (id obj, size_t idx) {
		switch (idx) {
		case 0:
			return @"foobar";
		case 1:
			return @"qux";
		}
316
317
318
319
320
321
322


















323
324
325
	    [[OFArray arrayWithObjects: [OFMutableString string], @"foo",
	    @"bar", @"baz", nil] foldUsingBlock: ^ id (id left, id right) {
		[left appendString: right];
		return left;
	    }])
#endif



















	[pool drain];
}
@end







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>



318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
	    [[OFArray arrayWithObjects: [OFMutableString string], @"foo",
	    @"bar", @"baz", nil] foldUsingBlock: ^ id (id left, id right) {
		[left appendString: right];
		return left;
	    }])
#endif

	TEST(@"-[valueForKey:]",
	    [[[OFArray arrayWithObjects: @"foo", @"bar", @"quxqux", nil]
	    valueForKey: @"length"] isEqual:
	    [OFArray arrayWithObjects: [OFNumber numberWithSize: 3],
	    [OFNumber numberWithSize: 3], [OFNumber numberWithSize: 6], nil]])

	m[0] = [OFMutableArray arrayWithObjects:
	    [OFURL URLWithString: @"http://foo.bar/"],
	    [OFURL URLWithString: @"http://bar.qux/"],
	    [OFURL URLWithString: @"http://qux.quxqux/"], nil];
	TEST(@"-[setValue:forKey:]",
	    R([m[0] setValue: [OFNumber numberWithShort: 1234]
		      forKey: @"port"]) &&
	    [m[0] isEqual: [OFArray arrayWithObjects:
	    [OFURL URLWithString: @"http://foo.bar:1234/"],
	    [OFURL URLWithString: @"http://bar.qux:1234/"],
	    [OFURL URLWithString: @"http://qux.quxqux:1234/"], nil]])

	[pool drain];
}
@end