Skip to content

Commit 10a7545

Browse files
committed
Merge branch 'master' of github.com:erikdoe/ocmock
2 parents 31c0871 + 2d83520 commit 10a7545

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

Source/OCMock/OCClassMockObject.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ - (void)prepareClassForClassMethodMocking
123123

124124
/* adding forwarder for most class methods (instance methods on meta class) to allow for verify after run */
125125
NSArray *methodBlackList = @[@"class", @"forwardingTargetForSelector:", @"methodSignatureForSelector:", @"forwardInvocation:", @"isBlock",
126-
@"instanceMethodForwarderForSelector:", @"instanceMethodSignatureForSelector:"];
126+
@"instanceMethodForwarderForSelector:", @"instanceMethodSignatureForSelector:", @"resolveClassMethod:"];
127127
[NSObject enumerateMethodsInClass:originalMetaClass usingBlock:^(Class cls, SEL sel) {
128128
if((cls == object_getClass([NSObject class])) || (cls == [NSObject class]) || (cls == object_getClass(cls)))
129129
return;

Source/OCMockTests/OCMockObjectRuntimeTests.m

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,28 @@ - (id)initMethodWithNestedInit
109109

110110
@end
111111

112+
@interface TestClassWithResolveMethods : NSObject
113+
@end
114+
115+
@implementation TestClassWithResolveMethods
116+
117+
- (void)instanceMethod {
118+
}
119+
120+
+ (BOOL)resolveInstanceMethod:(SEL)sel
121+
{
122+
return [super resolveInstanceMethod:sel];
123+
}
124+
125+
+ (void)classMethod {
126+
}
127+
128+
+ (BOOL)resolveClassMethod:(SEL)sel
129+
{
130+
return [super resolveClassMethod:sel];
131+
}
132+
133+
@end
112134

113135
#pragma mark Tests for interaction with runtime and foundation conventions
114136

@@ -283,6 +305,11 @@ - (void)testDynamicSubclassesShouldBeDisposed
283305
XCTAssertEqual(numClassesBefore, numClassesAfter, @"Should have disposed dynamically generated classes.");
284306
}
285307

308+
- (void)testClassesWithResolveMethodsCanBeMocked
309+
{
310+
// If this test fails it will crash due to recursion.
311+
__unused id mock = OCMClassMock([TestClassWithResolveMethods class]);
312+
}
286313

287314
#pragma mark verify mocks work properly when mocking init
288315

0 commit comments

Comments
 (0)