Tweak the weak tests so that they should still work, even if -base was compiled

with something that doesn't do a very good job of optimising autorelease
operations away.



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33644 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
theraven 2011-07-26 20:12:32 +00:00
parent a73835898d
commit 407c9d0053
3 changed files with 10 additions and 4 deletions

View file

@ -5,13 +5,15 @@
int main()
{
[NSAutoreleasePool new];
NSHashTable *ht = [NSHashTable hashTableWithWeakObjects];
id pool = [NSAutoreleasePool new];
NSHashTable *ht = [[NSHashTable hashTableWithWeakObjects] retain];
id obj = [NSObject new];
[ht addObject: obj];
PASS([ht containsObject: obj], "Added object to weak hash table");
PASS(1 == [ht count], "Weak hash table contains one object");
PASS([ht containsObject: obj], "Added object to weak hash table");
[obj release];
[pool drain];
PASS(0 == [ht count], "Weak hash table contains no objects");
PASS(0 == [[ht allObjects] count], "Weak hash table contains no objects");
return 0;