Differences From Artifact [ea65aa5e42]:
- File
tests/OFArrayTests.m
— part of check-in
[8a14ad35aa]
at
2016-02-21 11:59:44
on branch trunk
— OFArray: Fix bug introduced by refactorization
Also improves the test to prevent this from happening again. (user: js, size: 9081) [annotate] [blame] [check-ins using]
To Artifact [75808adfc5]:
- File
tests/OFArrayTests.m
— part of check-in
[05196e511a]
at
2016-06-05 15:00:33
on branch trunk
— Implement Key Value Coding for OFArray
If the key starts with an @, the @ is stripped and the super method is
called. Otherwise, this returns the value for all objects / sets the
value for all objects. (user: js, size: 9913) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
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 | case 1: return @"bar"; } return nil; }]) && [[m[0] description] isEqual: @"(\n\tfoo,\n\tbar\n)"]) | | | 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 |