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

Add internal init on struct to improve testing #529

Merged

Conversation

Thomaslegravier
Copy link

With swift 5 it's now impossible to add an extension of struct and implement a custom init.
It can be very useful for unit testing. In my case we use this method to create type components of a MockedStoreKit class.
I suggest to add internal init on type struct to permit init in unit testing context.

Swift evolution reference: https://github.com/apple/swift-evolution/blob/master/proposals/0189-restrict-cross-module-struct-initializers.md

@Sam-Spencer Sam-Spencer self-requested a review February 20, 2020 17:59
Copy link
Collaborator

@Sam-Spencer Sam-Spencer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a great improvement. I'm all for adopting new language features for Unit Tests.

If you'd like, we're looking for contributors and maintainers for the repo -- check out the Slack channel.

Writing unit tests would be mightily appreciated too!

@Sam-Spencer Sam-Spencer merged commit 9e9a118 into bizz84:develop Feb 20, 2020
@Thomaslegravier
Copy link
Author

Thomaslegravier commented Feb 24, 2020

Thanks @Sam-Spencer for feedback and approved my proposition.
Do you know when the next release will be?

@Sam-Spencer
Copy link
Collaborator

Yes! Check back this weekend for a new release! @Thomaslegravier

@Sam-Spencer Sam-Spencer linked an issue Mar 21, 2020 that may be closed by this pull request
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add public initialiser for internal classes
2 participants