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
622f81ffc2
commit
00259f1a7c
3 changed files with 10 additions and 4 deletions
|
@ -5,14 +5,16 @@
|
|||
int main()
|
||||
{
|
||||
[NSAutoreleasePool new];
|
||||
NSMapTable *map = [NSMapTable mapTableWithStrongToWeakObjects];
|
||||
NSMapTable *map2 = [NSMapTable mapTableWithWeakToStrongObjects];
|
||||
id pool = [NSAutoreleasePool new];
|
||||
NSMapTable *map = [[NSMapTable mapTableWithStrongToWeakObjects] retain];
|
||||
NSMapTable *map2 = [[NSMapTable mapTableWithWeakToStrongObjects] retain];
|
||||
id obj = [NSObject new];
|
||||
|
||||
[map setObject: obj forKey: @"1"];
|
||||
[map2 setObject: @"1" forKey: obj];
|
||||
PASS(obj == [map objectForKey: @"1"], "Value stored in weak-value map");
|
||||
PASS(nil != [map2 objectForKey: obj], "Value stored in weak-key map");
|
||||
[pool drain];
|
||||
[obj release];
|
||||
PASS(nil == [map objectForKey: @"1"], "Value removed from weak-value map");
|
||||
NSEnumerator *enumerator = [map2 keyEnumerator];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue