libs-base/Tests/base/NSException/throwstr.m

27 lines
477 B
Mathematica
Raw Normal View History

#import "Testing.h"
#import <Foundation/Foundation.h>
int main(void)
{
#if BASE_NATIVE_OBJC_EXCEPTIONS == 1
id caught = nil;
id thrown = @"thrown";
@try
{
@throw thrown;
}
@catch (id str)
{
caught = str;
}
[NSAutoreleasePool new];
START_SET(YES)
PASS((caught == thrown), "Throwing an NSConstantString instance before the class is initialised");
END_SET("String throwing")
#else
[NSAutoreleasePool new];
unsupported("Native exceptions");
#endif
return 0;
}