Skip to content

Commit 2fef3c6

Browse files
committed
Add basic descriptions for invocation actions.
Helps in debugging and error reporting.
1 parent b8746e5 commit 2fef3c6

6 files changed

+28
-0
lines changed

Source/OCMock/OCMBlockCaller.m

+5
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,9 @@ - (void)handleInvocation:(NSInvocation *)anInvocation
4343
}
4444
}
4545

46+
- (NSString *)description
47+
{
48+
return [NSString stringWithFormat:@"[%@ - %p]: Calls `%@`", [self class], self, block];
49+
}
50+
4651
@end

Source/OCMock/OCMExceptionReturnValueProvider.m

+5
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,9 @@ - (void)handleInvocation:(NSInvocation *)anInvocation
2727
[[NSException exceptionWithName:OCMStubbedException reason:@"Exception stubbed in test." userInfo:@{ @"exception": returnValue }] raise];
2828
}
2929

30+
- (NSString *)description
31+
{
32+
return [NSString stringWithFormat:@"[%@ - %p]: Throws `%@`", [self class], self, returnValue];
33+
}
34+
3035
@end

Source/OCMock/OCMIndirectReturnValueProvider.m

+5
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,9 @@ - (void)handleInvocation:(NSInvocation *)anInvocation
4949
[anInvocation setSelector:originalSelector];
5050
}
5151

52+
- (NSString *)description
53+
{
54+
return [NSString stringWithFormat:@"[%@ - %p]: Calls `%@` on `%@`", [self class], self, NSStringFromSelector(selector), provider];
55+
}
56+
5257
@end

Source/OCMock/OCMNonRetainingObjectReturnValueProvider.m

+5
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,10 @@ - (void)handleInvocation:(NSInvocation *)anInvocation
4848
}
4949
[anInvocation setReturnValue:&returnValue];
5050
}
51+
52+
- (NSString *)description
53+
{
54+
return [NSString stringWithFormat:@"[%@ - %p]: Returns `%@`", [self class], self, returnValue];
55+
}
5156
@end
5257

Source/OCMock/OCMNotificationPoster.m

+4
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,9 @@ - (void)handleInvocation:(NSInvocation *)anInvocation
4040
[[NSNotificationCenter defaultCenter] postNotification:notification];
4141
}
4242

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

4448
@end

Source/OCMock/OCMRealObjectForwarder.m

+4
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,9 @@ - (void)handleInvocation:(NSInvocation *)anInvocation
4444
[anInvocation invoke];
4545
}
4646

47+
- (NSString *)description
48+
{
49+
return [NSString stringWithFormat:@"[%@ - %p]", [self class], self];
50+
}
4751

4852
@end

0 commit comments

Comments
 (0)