mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
(main): Fix serious bug by including `nil' at end of contents list.
Test forward and reverse enumerator objects. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@317 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
0b30724d11
commit
0f103da9d3
1 changed files with 15 additions and 3 deletions
|
@ -3,13 +3,15 @@
|
|||
int
|
||||
main()
|
||||
{
|
||||
id a, b;
|
||||
id a, b; /* arrays */
|
||||
id enumerator;
|
||||
|
||||
set_behavior_debug(1);
|
||||
set_behavior_debug(0);
|
||||
a = [NSArray arrayWithObjects:
|
||||
[NSObject class],
|
||||
[NSArray class],
|
||||
[NSMutableArray class]];
|
||||
[NSMutableArray class],
|
||||
nil];
|
||||
|
||||
printf("NSArray has count %d\n", [a count]);
|
||||
printf("Classname at index 1 is %s\n", [[a objectAtIndex:1] name]);
|
||||
|
@ -17,6 +19,16 @@ main()
|
|||
assert([a containsObject:[NSObject class]]);
|
||||
assert([a lastObject]);
|
||||
[a makeObjectsPerform:@selector(self)];
|
||||
|
||||
enumerator = [a objectEnumerator];
|
||||
while ((b = [enumerator nextObject]))
|
||||
printf("%s ", [b name]);
|
||||
printf("\n");
|
||||
|
||||
enumerator = [a reverseObjectEnumerator];
|
||||
while ((b = [enumerator nextObject]))
|
||||
printf("%s ", [b name]);
|
||||
printf("\n");
|
||||
|
||||
b = [a mutableCopy];
|
||||
assert([b count]);
|
||||
|
|
Loading…
Reference in a new issue