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

Allow OCMock to be used with EarlGrey for UITesting #481

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dmaclach
Copy link
Contributor

@dmaclach dmaclach commented Jan 16, 2021

We have a need to inject a replacement for OCMMacroState for when we are doing cross
process testing using a library like https://github.com/google/EarlGrey/tree/earlgrey2.

See #484.

This simple expansion to the basic macros will give us the flexibility we need to allow
us to use OCMock v3 syntax instead of falling back to OCMock v2 syntax when working
with EarlGrey tests.

The modification to andReturn macro allows us to move objects across the process boundary
instead of "hiding" an object inside of an NSValue. The "hack" of using NSArray as a
tuple could be replaced by a real object, or an NSDictionary, but I went with the simple
stupid approach to start.

This also gets rid of some "undefined behavior" in the previous macro where we were potentially casting a pod type to an id .

@dmaclach dmaclach marked this pull request as draft January 28, 2021 05:53
@dmaclach dmaclach marked this pull request as ready for review January 29, 2021 19:18
@dmaclach dmaclach changed the title Allow injection of macro state class into OCM macros Allow OCMock to be used with EarlGrey for UITesting Jan 29, 2021
We have a need to inject a replacement for `OCMMacroState` for when we are doing cross
process testing using a library like https://github.com/google/EarlGrey/tree/earlgrey2.

This simple expansion to the basic macros will give us the flexibility we need to allow
us to use OCMock v3 syntax instead of falling back to OCMock v2 syntax when working
with EarlGrey tests.

The modification to andReturn macro allows us to move objects across the process boundary
instead of "hiding" an object instead of an NSValue. The "hack" of using NSArray as a
tuple could be replaced by a real object, or an NSDictionary, but I went with the simple
stupid approach to start.
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

Successfully merging this pull request may close these issues.

1 participant