-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Allow specifying testing libraries for swift package init
#7186
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
Conversation
This PR adds `-enable-experimental-swift-testing` (and `-disable-xctest` and their inverses) to `swift package init`. These options behave, broadly, the same as they do for `swift test`. They determine which testing library a new package will use and adjust the generated template to match. It is important to note that any combination of the two libraries is supported: a developer may wish to use only one or the other, or both, or may wish to opt out of a test target entirely. All four combinations are supported, however for simplicity's sake if both libraries are enabled, we only generate example code for swift-testing. Note that right now, correct macro target support is impeded by swiftlang/swift-syntax#2400. I don't think that issue blocks a change here (since it's in an experimental feature anyway!) but it does mean that `swift package init --type macro --enable-experimental-swift-testing` produces some dead tests. Once that issue is resolved, we can revise the template to produce meaningful tests instead. Resolves rdar://99279056.
@swift-ci please test |
Thinking about it, replacement API in swift-syntax won't have an associated tag for a while anyway, so we definitely shouldn't block on it. |
I think |
We can certainly do that. |
@swift-ci please test |
@swift-ci test windows |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but I hope we can avoid using stream.send
while we're at it.
swift package init
@swift-ci please test |
@swift-ci please test Windows |
@swift-ci please clean test Windows |
This PR adds
-enable-experimental-swift-testing
(and-disable-xctest
and their inverses) toswift package init
. These options behave, broadly, the same as they do forswift test
. They determine which testing library a new package will use and adjust the generated template to match.It is important to note that any combination of the two libraries is supported: a developer may wish to use only one or the other, or both, or may wish to opt out of a test target entirely. All four combinations are supported, however for simplicity's sake if both libraries are enabled, we only generate example code for swift-testing.
Note that right now, correct macro target support is impeded by swiftlang/swift-syntax#2400. I don't think that issue blocks a change here (since it's in an experimental feature anyway!) but it does mean that
swift package init --type macro --enable-experimental-swift-testing
produces some dead tests. Once that issue is resolved, we can revise the template to produce meaningful tests instead.Resolves rdar://99279056.