-
Notifications
You must be signed in to change notification settings - Fork 66
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
Expose Testing test identifier from test context #125
Conversation
/// Testing framework, or Xcode's XCTest framework. | ||
public enum TestContext { | ||
/// The Swift Testing framework. | ||
case swiftTesting | ||
case swiftTesting(Testing) |
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.
Technically this is a breaking change for folks referring directly to this .swiftTesting
case, so we could introduce a new set of alternate APIs here instead.
If someone was merely switching over the cases in their test helper it should be source compatible, though.
#expect(TestContext.current == .swiftTesting) | ||
switch TestContext.current { | ||
case .swiftTesting: | ||
#expect(true) | ||
default: | ||
Issue.record() | ||
} |
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.
An example API breakage and fix.
It can be useful to distinguish between tests in addition to knowing the test context, so let's surface some of that data.
One example use case, preventing global state from bleeding between tests in our Dependencies library: pointfreeco/swift-dependencies#269