]> git.saurik.com Git - apple/objc4.git/blob - test/association-cf.m
objc4-437.tar.gz
[apple/objc4.git] / test / association-cf.m
1 #include <CoreFoundation/CoreFoundation.h>
2 #include <objc/runtime.h>
3
4 #include "test.h"
5
6 int main()
7 {
8 // rdar://6164781 setAssociatedObject on pure-CF object crashes LP64
9
10 id obj;
11 CFArrayRef array = CFArrayCreate(0, 0, 0, 0);
12 testassert(array);
13
14 testassert(! objc_getClass("NSCFArray"));
15
16 objc_setAssociatedObject((id)array, (void*)1, (id)array, OBJC_ASSOCIATION_ASSIGN);
17
18 obj = objc_getAssociatedObject((id)array, (void*)1);
19 testassert(obj == (id)array);
20
21 CFRelease(array);
22
23 succeed(__FILE__);
24 }