-
Notifications
You must be signed in to change notification settings - Fork 609
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add location recording to all macros. #431
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please take my comments with a grain of salt because I am not very familiar with this code base.
NSString *explanation = @"Did not record an invocation in OCMStub/OCMExpect/OCMReject.\n" | ||
@"Possible causes are:\n" | ||
@"- The receiver is not a mock object.\n" | ||
@"- The selector conflicts with a selector implemented by OCMStubRecorder/OCMExpectationRecorder."; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you give me an outline of how that would work?
OCMLocation *location = recorder.ocm_location; | ||
NSString *explanation = @"Did not record an invocation in OCMStub/OCMExpect/OCMReject.\n" | ||
@"Possible causes are:\n" | ||
@"- The receiver is not a mock object.\n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer that we would assert that the received object isKindOfClass OCMockObject in beginStubMacro/beginExpectMacro/beginRejectMacro
(and this way give a much more informative message and have a proper stack trace)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry tzvist, could you clarify which received object are you talking about? If it's what I think you are saying, we don't have that info in the begin*Macro
method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After looking at it some more I have misunderstand the way OCMock finds the class that is stubbed, apparently my proposal would not work.
NSString *explanation = @"Did not record an invocation in OCMStub/OCMExpect/OCMReject.\n" | ||
@"Possible causes are:\n" | ||
@"- The receiver is not a mock object.\n" | ||
@"- The selector conflicts with a selector implemented by OCMStubRecorder/OCMExpectationRecorder."; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you give me an outline of how that would work?
Removed the references to self from
|
For large CI systems it can be costly to generate debug information. Recording location data for all of the stub/expect/reject macros makes it a lot easier to record/find failures.
For large CI systems it can be costly to generate debug information.
Recording location data for all of the stub/expect/reject macros makes
it a lot easier to record/find failures.
Also renames
location
toocm_location
to avoid conflicts with objects that we are mocking that already have a location/setLocation method.