Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion Source/OCMock/OCMockObject.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@
#import "OCProtocolMockObject.h"


@implementation OCMockObject
@implementation OCMockObject {
BOOL _mustBeVerified;
}

#pragma mark Class initialisation

Expand Down Expand Up @@ -119,6 +121,11 @@ - (instancetype)init

- (void)dealloc
{
if(_mustBeVerified){
NSString *description = [NSString stringWithFormat:@"%@: was deallocated without being verified",
[self description]];
OCMReportFailure(nil, description);
}
[stubs release];
[expectations release];
[exceptions release];
Expand Down Expand Up @@ -153,6 +160,7 @@ - (OCMInvocationStub *)stubForInvocation:(NSInvocation *)anInvocation

- (void)addExpectation:(OCMInvocationExpectation *)anExpectation
{
_mustBeVerified = YES;
@synchronized(expectations)
{
[expectations addObject:anExpectation];
Expand Down Expand Up @@ -228,6 +236,7 @@ - (id)verify

- (id)verifyAtLocation:(OCMLocation *)location
{
_mustBeVerified = NO;
NSMutableArray *unsatisfiedExpectations = [NSMutableArray array];
@synchronized(expectations)
{
Expand Down
Loading