Skip to content

Commit

Permalink
Add basic descriptions for invocation actions.
Browse files Browse the repository at this point in the history
Helps in debugging and error reporting.
  • Loading branch information
dmaclach committed Aug 13, 2020
1 parent ffeeed2 commit 5e01c36
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Source/OCMock/OCMBlockCaller.m
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,9 @@ - (void)handleInvocation:(NSInvocation *)anInvocation
}
}

- (NSString *)description
{
return [NSString stringWithFormat:@"[%@ - %p]: Calls `%@`", [self class], self, block];
}

@end
5 changes: 5 additions & 0 deletions Source/OCMock/OCMExceptionReturnValueProvider.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,9 @@ - (void)handleInvocation:(NSInvocation *)anInvocation
[[NSException exceptionWithName:OCMStubbedException reason:@"Exception stubbed in test." userInfo:@{ @"exception": returnValue }] raise];
}

- (NSString *)description
{
return [NSString stringWithFormat:@"[%@ - %p]: Throws `%@`", [self class], self, returnValue];
}

@end
5 changes: 5 additions & 0 deletions Source/OCMock/OCMIndirectReturnValueProvider.m
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,9 @@ - (void)handleInvocation:(NSInvocation *)anInvocation
[anInvocation setSelector:originalSelector];
}

- (NSString *)description
{
return [NSString stringWithFormat:@"[%@ - %p]: Calls `%@` on `%@`", [self class], self, NSStringFromSelector(selector), provider];
}

@end
5 changes: 5 additions & 0 deletions Source/OCMock/OCMNonRetainingObjectReturnValueProvider.m
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,10 @@ - (void)handleInvocation:(NSInvocation *)anInvocation
}
[anInvocation setReturnValue:&returnValue];
}

- (NSString *)description
{
return [NSString stringWithFormat:@"[%@ - %p]: Returns `%@`", [self class], self, returnValue];
}
@end

4 changes: 4 additions & 0 deletions Source/OCMock/OCMNotificationPoster.m
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,9 @@ - (void)handleInvocation:(NSInvocation *)anInvocation
[[NSNotificationCenter defaultCenter] postNotification:notification];
}

- (NSString *)description
{
return [NSString stringWithFormat:@"[%@ - %p]: Posts `%@`", [self class], self, notification];
}

@end
4 changes: 4 additions & 0 deletions Source/OCMock/OCMRealObjectForwarder.m
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,9 @@ - (void)handleInvocation:(NSInvocation *)anInvocation
[anInvocation invoke];
}

- (NSString *)description
{
return [NSString stringWithFormat:@"[%@ - %p]", [self class], self];
}

@end

0 comments on commit 5e01c36

Please sign in to comment.