From 53f5c4ec97bebf60431055b841d0efa43e8bdc10 Mon Sep 17 00:00:00 2001 From: David Chisnall Date: Wed, 23 Feb 2011 18:39:26 +0000 Subject: [PATCH] Added test that the runtime allows us to throw instances of objects that have not been properly initialised. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@32337 72102866-910b-0410-8b05-ffd578937521 --- Tests/base/NSException/throwstr.m | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 Tests/base/NSException/throwstr.m diff --git a/Tests/base/NSException/throwstr.m b/Tests/base/NSException/throwstr.m new file mode 100644 index 000000000..955e7dc45 --- /dev/null +++ b/Tests/base/NSException/throwstr.m @@ -0,0 +1,24 @@ +#import "Testing.h" +#import + +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]; + PASS((caught == thrown), "Throwing an NSConstantString instance before the class is initialised"); +#else + [NSAutoreleasePool new]; + unsupported("Native exceptions"); +#endif + return 0; +}