-
Notifications
You must be signed in to change notification settings - Fork 10.5k
SR-1417: Add non-optional overloads of XCTAssertEqual and XCTAssertNotEqual #2788
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
…tEqual Previously, the only version of the functions that accepted values was the one that implicitly wraps them into Optionals. This generated a confusing error message when the assert failed. Having a separate overload that accepts non-optional types ensures that the correct description is printed when the assert fails.
@swift-ci please test |
@@ -21,8 +21,24 @@ var XCTestTestSuite = TestSuite("XCTest") | |||
// instantiate an NSInvocation with the given selector. | |||
|
|||
|
|||
func execute(_ run: () -> ()) { | |||
func execute(observers: [XCTestObservation] = [], _ run: () -> Void) { |
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.
I think this function was originally added to get around the duplicate definitions of XCTest.run()
. Seeing as how its role is expanding here, I wouldn't mind a rename at some point (in a future pull request maybe).
Awesome! This is such a huge improvement over the current failure messages. Thanks, @nsalmoria and @briancroom!! 👍 I'll defer to @mike-ferris-apple to merge, in case this is something the Apple XCTest team cares about. |
Sorry for the delay. This looks great to me. Not sure what happened with the ci... The link to the linux failure seems busted. I'll kick off another one. |
@swift-ci please test |
@modocache Please feel free to merge when this passes CI. |
Fantastic, thanks @mike-ferris-apple! |
What's in this pull request?
This is #2551 updated to include a more comprehensive test that the failure message produced by the newly introduced overload is working as-desired.
From @nsalmoria's original pull request:
CC @modocache @mike-ferris-apple
Resolved bug number: (SR-1417)
Before merging this pull request to apple/swift repository:
Triggering Swift CI
The swift-ci is triggered by writing a comment on this PR addressed to the GitHub user @swift-ci. Different tests will run depending on the specific comment that you use. The currently available comments are:
Smoke Testing
Validation Testing
Lint Testing
Note: Only members of the Apple organization can trigger swift-ci.