Skip to content

Commit c967bf9

Browse files
committed
Variations on the syntax.
1 parent e6fc18e commit c967bf9

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

Source/OCMock/OCMock.h

+7-1
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,14 @@
3838
[OCMMacroState endExpectMacro]; \
3939
})
4040

41-
#define classMethod(invocation) \
41+
#define ClassMethod(invocation) \
4242
[[OCMMacroState globalState] setShouldRecordAsClassMethod:YES]; \
4343
invocation;
4444

45+
#define classObject(mock) \
46+
({ \
47+
[[OCMMacroState globalState] setShouldRecordAsClassMethod:YES]; \
48+
mock; \
49+
})
50+
4551
#define OCMVerifyAll(mock) [mock verifyAtLocation:OCMMakeLocation(self, __FILE__, __LINE__)]

Source/OCMockTests/OCMockObjectMacroTests.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ - (void)testCanExplicitlySelectClassMethod
210210
{
211211
id mock = OCMClassMock([TestClassWithClassMethods class]);
212212

213-
OCMStub(classMethod([mock bar])).andReturn(@"mocked-class");
213+
OCMStub(ClassMethod([mock bar])).andReturn(@"mocked-class");
214214
OCMStub([mock bar]).andReturn(@"mocked-instance");
215215

216216
XCTAssertEqualObjects(@"mocked-class", [TestClassWithClassMethods bar], @"Should have stubbed class method.");

0 commit comments

Comments
 (0)