#IUO XCTestCase.waitForExpectationsWithTimeout 's second argument should be Optional and default to nil
| Originator: | Ziad.khoury.h | ||
| Number: | rdar://18403222 | Date Originated: | 20-Sep-2014 10:08 AM |
| Status: | Open | Resolved: | |
| Product: | Developer Tools | Product Version: | 6.0.1 (6A317) |
| Classification: | Enhancement | Reproducible: | Always |
Summary:
Swift declares:
XCTestCase.waitForExpectationsWithTimeout(timeout: NSTimeInterval, handler handlerOrNil: XCWaitCompletionHandler!)
`handerOrNil` should be `XCWaitCompletionHandler?` and default to `nil`, like:
XCTestCase.waitForExpectationsWithTimeout(timeout: NSTimeInterval, handler handlerOrNil: XCWaitCompletionHandler? = nil)
So that it can be called without providing nil as the second argument.
Steps to Reproduce:
In a swift XC test write:
self.waitForExpectationsWithTimeout(1)
Expected Results:
It works without compiler errors
Actual Results:
Gives a compile-time error:
Type '(NSTimeInterval, handler: XCWaitCompletionHandler!)' does not conform to protocol 'IntegerLiteralConvertible'
Version:
Xcode 6.0.1 (6A317)
Notes:
As workaround I added the following extension to XCTestCase:
public extension XCTestCase {
public func waitForExpectationsWithTimeout(timeout: NSTimeInterval) {
self.waitForExpectationsWithTimeout(timeout, handler: nil)
}
}
Configuration:
OS X 10.9.5
Attachments:
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!