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

given only works for ObjC methods #11

Closed
tomaz opened this issue Nov 12, 2012 · 4 comments
Closed

given only works for ObjC methods #11

tomaz opened this issue Nov 12, 2012 · 4 comments

Comments

@tomaz
Copy link

tomaz commented Nov 12, 2012

Default implementation doesn't work in Cedar due to using self in given macro definition. Cedar uses plain C functions, so self isn't available. To compensate, I use this macro:

#ifdef given
#   undef given
#   define given(methodCall) MKTGivenWithLocation([SpecHelper specHelper], __FILE__, __LINE__, methodCall)
#endif

Would be nice to support plain C style of unit tests as well.

@jonreid
Copy link
Owner

jonreid commented Feb 22, 2013

The purpose for that self is to have something to report errors to directly (instead of via an exception).

In the current implementation, you're doing what I'd do: create a different macro to call MKTGivenWithLocation.

But as a real solution, I think what OCMockito needs is a switch to say, "Use exceptions instead."

@jonreid
Copy link
Owner

jonreid commented Dec 31, 2014

@tomaz OCMockito now relies on OCHamcrest for failure reporting. If you're still interested in a way to use OCMockito in Cedar, I'll tackle it first in hamcrest/OCHamcrest#63. Then add givenC etc.

@tomaz
Copy link
Author

tomaz commented Jan 5, 2015

Thanks. No rush for that, at least for me - I since reverted to XCTest.

@jonreid
Copy link
Owner

jonreid commented Sep 12, 2015

It looks like Cedar has changed? Closing, feel free to reopen if it's still an issue.

@jonreid jonreid closed this as completed Sep 12, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants