2 #include <objc/objc-exception.h>
3 #include <Foundation/Foundation.h>
5 #if !defined(__OBJC2__)
16 @interface Foo : NSObject @end
18 @interface Foo (Unimplemented)
25 -(void)check { state++; }
26 +(void)check { testassert(!"caught class object, not instance"); }
30 static void handler(id unused __unused, void *ctx __unused)
32 testassert(state == 3); state++;
35 +(BOOL) resolveClassMethod:(SEL)__unused name
37 testassert(state == 1); state++;
38 objc_addExceptionHandler(&handler, 0);
39 testassert(state == 2); state++;
51 // unwind exception and alt handler through objc_msgSend()
53 NSAutoreleasePool *pool = [NSAutoreleasePool new];
56 for (i = 0; i < 100000; i++) {
58 testassert(state == 0); state++;
61 } @catch (NSException *e) {
65 testassert(state == 4); state++;
66 testassert(state == 5); [e check]; // state++
73 testassert(state == 6); state++;
75 testassert(state == 7); state = 0;