Skip to content
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

OCMock partial mocks crash when used with objc_direct methods that directly access instance variables. #541

Open
goddess-eris opened this issue Jul 5, 2024 · 1 comment

Comments

@goddess-eris
Copy link

OCMock partial mocks crash when used with objc_direct methods that directly access instance variables. The code provided is a test case which shows the problem.

It's likely that nothing can be done about this, but it's worth adding a note to the documentation, in the section about Partial Mocks. In my opinion, this falls into the category of "There are some subtleties when using partial mocks."

MockingJayTests.m.zip

@erikdoe
Copy link
Owner

erikdoe commented Oct 5, 2024

Thank you for providing the test. With Xcode 16 I can't reproduce the crash, though. The behaviour I'm seeing is a failing test because the assertion fails:

0x600003c009c0 foo _info 0x0 -info 0x103441510
[OCMockObjectRuntimeTests testExample] : ((_info == [self info]) is true) failed

It looks like _info is nil. That's a problem in its own right but it's different from what you are seeing. Can you confirm that you see a crash in Xcode 16? And if so, are you on Intel or Apple Silicon?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants