blob: 88e3d8ea7d192a87d24c126b028718d076c8925b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
/* Contributed by Nicola Pero - Fri Dec 14 08:36:00 GMT 2001 */
/* { dg-do run } */
/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
#include <objc/objc.h>
#ifndef __NEXT_RUNTIME__
#include <objc/objc-api.h>
#endif
#include "../../objc-obj-c++-shared/next-mapping.h"
extern void abort (void);
/* Test loading unclaimed categories - categories of a class defined
separately from the class itself. */
/* unclaimed-category-1.m contains only the class definition but not
the categories. unclaimed-category-1a.m contains only the
categories of the class, but not the class itself. We want to
check that the runtime can load the class from one module (file)
and the categories from another module (file). */
#include "unclaimed-category-1.h"
@implementation TestClass
- (int)D
{
return 4;
}
#ifdef __NEXT_RUNTIME__
+ initialize { return self; }
#endif
@end
int main (void)
{
TestClass *test;
Class testClass;
testClass = objc_get_class ("TestClass");
if (testClass == Nil)
{
abort ();
}
test = (TestClass *)(class_create_instance (testClass));
if (test == nil)
{
abort ();
}
if ([test A] != 1)
{
abort ();
}
if ([test B] != 2)
{
abort ();
}
if ([test C] != 3)
{
abort ();
}
if ([test D] != 4)
{
abort ();
}
return 0;
}
|