* Added MYReturnError.
* Better iPhone support in ExceptionUtils.
* Make sure "All Tests Passed/Failed" message is always logged.
5 // Copyright 2008 Jens Alfke. All rights reserved.
12 @interface NSObject (With)
13 - (BOOL) endWith: (NSException*)x;
17 void _catchWith( id with, NSException *x )
19 Warn(@"Exception thrown from WITH(%@) block: %@",[with class],x);
20 if( [with respondsToSelector: @selector(endWith:)] ) {
21 if( ! [with endWith: x] )
22 @throw x; // propagate the exception if -endWith: returns NO
30 @implementation NSAutoreleasePool (With)
31 + (NSAutoreleasePool*) beginWith {return [self new];}
32 - (void) endWith {[self drain];}
33 - (BOOL) endWith: (NSException*)x {[self drain]; return YES;}
38 Copyright (c) 2008, Jens Alfke <jens@mooseyard.com>. All rights reserved.
40 Redistribution and use in source and binary forms, with or without modification, are permitted
41 provided that the following conditions are met:
43 * Redistributions of source code must retain the above copyright notice, this list of conditions
44 and the following disclaimer.
45 * Redistributions in binary form must reproduce the above copyright notice, this list of conditions
46 and the following disclaimer in the documentation and/or other materials provided with the
49 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
50 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
51 FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRI-
52 BUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
53 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
54 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
55 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
56 THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.