mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +00:00
Skip NSHashTable/NSMapTable weak objects tests if ARC is unavailable
This commit is contained in:
parent
260a2cb969
commit
d8565b075f
2 changed files with 22 additions and 0 deletions
|
@ -1,9 +1,19 @@
|
|||
#import "ObjectTesting.h"
|
||||
#import <Foundation/NSAutoreleasePool.h>
|
||||
#import <Foundation/NSHashTable.h>
|
||||
#if __has_include(<objc/capabilities.h>)
|
||||
#include <objc/capabilities.h>
|
||||
#endif
|
||||
|
||||
int main()
|
||||
{
|
||||
START_SET("NSHashTable weak objects")
|
||||
#ifdef OBJC_CAP_ARC
|
||||
if (!objc_test_capability(OBJC_CAP_ARC))
|
||||
#endif
|
||||
{
|
||||
SKIP("ARC support unavailable")
|
||||
}
|
||||
NSAutoreleasePool *arp = [NSAutoreleasePool new];
|
||||
NSHashTable *hashTable = [NSHashTable weakObjectsHashTable];
|
||||
|
||||
|
@ -18,5 +28,6 @@ int main()
|
|||
PASS([[hashTable allObjects] count] == 0, "Table removes dead weak reference");
|
||||
|
||||
[arp release]; arp = nil;
|
||||
END_SET("NSHashTable weak objects")
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,9 +1,19 @@
|
|||
#import "ObjectTesting.h"
|
||||
#import <Foundation/NSAutoreleasePool.h>
|
||||
#import <Foundation/NSMapTable.h>
|
||||
#if __has_include(<objc/capabilities.h>)
|
||||
#include <objc/capabilities.h>
|
||||
#endif
|
||||
|
||||
int main()
|
||||
{
|
||||
START_SET("NSMapTable weak objects")
|
||||
#ifdef OBJC_CAP_ARC
|
||||
if (!objc_test_capability(OBJC_CAP_ARC))
|
||||
#endif
|
||||
{
|
||||
SKIP("ARC support unavailable")
|
||||
}
|
||||
NSAutoreleasePool *arp = [NSAutoreleasePool new];
|
||||
NSMapTable *mapTable = [NSMapTable strongToWeakObjectsMapTable];
|
||||
|
||||
|
@ -18,5 +28,6 @@ int main()
|
|||
PASS([mapTable objectForKey:@"test"] == nil, "Table removes dead weak reference");
|
||||
|
||||
[arp release]; arp = nil;
|
||||
END_SET("NSMapTable weak objects")
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue