mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 16:30:41 +00:00
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:
parent
a73835898d
commit
407c9d0053
3 changed files with 10 additions and 4 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue