Skip to content

Don't use StaticString for XCTAssert* #27

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

Closed
wants to merge 2 commits into from

Conversation

briancroom
Copy link
Contributor

This addresses SR-308, bringing us in line with Apple's XCTest in using String instead of StaticString as the type of the file parameter on assertions.

Included is a minor refactor of how failure handling is structured in order to allow proper failure reporting before termination in the case of continueAfterFailure being false. I managed to reduce global state a little in the process.

* Refactor to rely less on global state for failure reporting
* Handle failures with a closure capturing the current test method name
  so that the failure can be printed before erroring out
@gribozavr
Copy link
Contributor

Why not change the XCTest overlay instead? StaticString is inherently cheaper than String.

@modocache
Copy link
Contributor

Why not change the XCTest overlay instead?

Oh, this would be awesome.

Slightly related: swiftlang/swift#785. It would be cool to expand the overlay's test suite so that it could catch any regressions in the StaticString change. swiftlang/swift#785 may be a useful reference when doing so.

@mike-ferris
Copy link

I agree with @gribozavr... I would rather see this redone as a pull request for the XCTest overlay in the swift project instead of this change.

@mike-ferris
Copy link

Actually I see you already did. I merged #888 in the swift project, so let's go ahead and close this one.

@briancroom briancroom closed this Jan 8, 2016
@briancroom
Copy link
Contributor Author

@mike-ferris-apple how do you feel about the refactoring in briancroom@cc2ae5d ? Would you consider merging it if I open a separate PR?

I consider it an improvement due to the reduction of global vars and the removal of the public testFailure function.

@mike-ferris
Copy link

Ah, I didn’t notice that. Yeah, that seems like an improvement. It also gets rid of that weird public function that shouldn’t be public (and probably doesn’t need to be anymore, but I’ve never gotten around to verifying that…)

Go ahead and do a new PR for that if you want!

Mike

On Jan 7, 2016, at 4:35 PM, Brian Croom [email protected] wrote:

@mike-ferris-apple https://github.com/mike-ferris-apple how do you feel about the refactoring in briancroom/swift-corelibs-xctest@cc2ae5d briancroom@cc2ae5d ? Would you consider merging it if I open a separate PR?

I consider it an improvement due to the reduction of global vars and the removal of the public testFailure function.


Reply to this email directly or view it on GitHub #27 (comment).

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

Successfully merging this pull request may close these issues.

4 participants