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

Is a singleton registry hub the right way to go? #1421

Open
davnat opened this issue Oct 22, 2018 · 0 comments
Open

Is a singleton registry hub the right way to go? #1421

davnat opened this issue Oct 22, 2018 · 0 comments

Comments

@davnat
Copy link

davnat commented Oct 22, 2018

Referring to #454 and this comment, I'm opening this issue to understand the developers point of view on this topic.

From the description of #454:

This patch adds support for XCTest integration by inverting the usual Catch behavior; rather than using Catch as the test runner, we dynamically register XCTestCase classes with the Objective-C runtime to allow Xcode's test runner to execute (and report on) Catch-defined test cases.

and

the +[XCTestCaseCatchRegistry load] method will insert an XCTestRegistryHub instance that automatically registers XCTestCase classes for any Catch test cases defined within the image.

Unfortunately, 5884ec1 made the registry hub a singleton of type Singleton<RegistryHub, IRegistryHub, IMutableRegistryHub>, and the methods getRegistryHub() and getMutableRegistryHub() need the type of the singleton to be statically defined, so the approach used in #454 is not working anymore.

To make #454 work in this context we would need a way to statically define the registry hub to be something like Singleton<XCTestRegistryHub, IRegistryHub, IMutableRegistryHub>, but I don't see how this could be possible, because XCTestRegistryHub needs to inherit at least from IRegistryHub, that is only available if we already included catch.hpp, but the definition of the singleton in catch.hpp would need XCTestRegistryHub to be defined before its inclusion.

Maybe I'm still missing something here (to be honest, I hope so), but I can't see any way to make #454 work with a singleton registry hub, and this brings me to the original question: are you really sure that a singleton registry hub is the right way to go?

Thanks, cheers

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

1 participant