-
Notifications
You must be signed in to change notification settings - Fork 263
[XCTestMain] Don't XCTPrint arrays of strings #45
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
`XCTPrint()` takes a variadic argument of items to print, mirroring the API of `print()` itself. Unfortunately, passing this variadic argument directly to `print()` causes an array object to be printed. For example: ```swift func XCTPrint(items: Any...) { print(items) } XCTPrint("Hello!") // Prints '["Hello!"]\n' ``` As a result of this behavior, swift-corelibs-xctest currently prints out test output such as the following: ``` ["Test Case \'ErrorHandling.test_shouldButDoesNotThrowErrorInAssertion\' failed (0.0 seconds)."] ["Test Case \'ErrorHandling.test_shouldThrowErrorInAssertion\' started."] ``` This is different from the expected output in `Tests/Functional`, which is causing the test suite to fail. Instead of mirroring the `print()` API, have `XCTPrint()` simply take a string object to print. This has the added benefit of being simpler--we can add the variadic arguments and the line separator parameter back if we ever need them.
Let's get this merged! Thanks for opening this @modocache and bringing up the underrepresentation of this suite in the swift.org automated testing systems (Oh the irony..!) @mike-ferris-apple do you know who would be in a position to assist with CI integration for this project? |
[XCTestMain] Don't XCTPrint arrays of strings
Awesome, thanks @mike-ferris-apple! 👍 |
Thanks for pushing this along @modocache! I can help some with CI integration questions -- @emish and @shahmishal are the primary contacts. |
@briancroom, Any specific questions you have about CI? |
@modocache, This repo has been added to CI for pull request testing, however it can only be triggered by individuals with write access. https://ci.swift.org/view/Pull%20Request/job/swift-corelibs-xctest-PR-Linux/ |
@shahmishal Awesome! Thanks a ton. Unfortunately the Swift build script doesn't test swift-corelibs-xctest yet, but I'm hoping to fix that soon. #43 (comment) and #43 (comment) have details. |
XCTPrint()
takes a variadic argument of items to print, mirroring the API ofprint()
itself. Unfortunately, passing this variadic argument directly toprint()
causes an array object to be printed. For example:As a result of this behavior, swift-corelibs-xctest currently prints out test output such as the following:
This is different from the expected output in
Tests/Functional
, which is causing the test suite to fail.Instead of mirroring the
print()
API, haveXCTPrint()
simply take a string object to print. This has the added benefit of being simpler--we can add the variadic arguments and the line separator parameter back if we ever need them. The test suite passes with this change.On a related note: