Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow mocked messages to throw exceptions.
There is a confirmed bug in iOS 4.0 that prevents this from working in the simulator although it works fine with the device. Dupe filed: http://openradar.appspot.com/8237699
- Loading branch information
1 parent
f86d0e9
commit c18bd3e
Showing
5 changed files
with
88 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// | ||
// LRThrowExceptionAction.h | ||
// Mocky | ||
// | ||
// Created by Luke Redpath on 27/07/2010. | ||
// Copyright (c) 2010 LJR Software Limited. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
#import "LRExpectationAction.h" | ||
|
||
@interface LRThrowExceptionAction : NSObject <LRExpectationAction> { | ||
NSException *exceptionToThrow; | ||
} | ||
- (id)initWithException:(NSException *)exception; | ||
@end | ||
|
||
LRThrowExceptionAction *LRA_throwException(NSException *exception); | ||
|
||
#ifdef LRMOCKY_SHORTHAND | ||
#define throwException LRA_throwException | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// | ||
// LRThrowExceptionAction.m | ||
// Mocky | ||
// | ||
// Created by Luke Redpath on 27/07/2010. | ||
// Copyright (c) 2010 LJR Software Limited. All rights reserved. | ||
// | ||
|
||
#import "LRThrowExceptionAction.h" | ||
|
||
|
||
@implementation LRThrowExceptionAction | ||
|
||
- (id)initWithException:(NSException *)exception; | ||
{ | ||
if (self = [super init]) { | ||
exceptionToThrow = [exception retain]; | ||
} | ||
return self; | ||
} | ||
|
||
- (void)dealloc | ||
{ | ||
[exceptionToThrow release]; | ||
[super dealloc]; | ||
} | ||
|
||
- (void)invoke:(NSInvocation *)invocation | ||
{ | ||
[exceptionToThrow raise]; | ||
} | ||
|
||
@end | ||
|
||
LRThrowExceptionAction *LRA_throwException(NSException *exception) | ||
{ | ||
return [[[LRThrowExceptionAction alloc] initWithException:exception] autorelease]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters