-
Notifications
You must be signed in to change notification settings - Fork 269
Closed
Description
| Previous ID | SR-308 |
| Radar | None |
| Original Reporter | @briancroom |
| Type | Bug |
| Status | Closed |
| Resolution | Done |
Additional Detail from JIRA
| Votes | 1 |
| Component/s | XCTest |
| Labels | Bug |
| Assignee | @briancroom |
| Priority | Medium |
md5: 04b054794f20358bffdcb2afab563c6d
Issue Description:
Xcode's XCTest has the following signature for XCTAssert:
public func XCTAssert(@autoclosure expression: () -> BooleanType, _ message: String = default, file: String = default, line: UInt = default)while swift-corelibs-xctest has:
public func XCTAssert(@autoclosure expression: () -> BooleanType, _ message: String = "", file: StaticString = __FILE__, line: UInt = __LINE__)Note the different types for the `file` parameter. Due to this inconsistency, custom assertion functions which capture file+line from their caller and then delegate to XCTAssert* don't compile on both platforms without resorting to a conditionally-compiled typealias. e.g.:
#if os(Linux)
typealias FileString = StaticString
#else
typealias FileString = String
#endif
func assertAwesomeness(string: String, file: FileString = __FILE__, line: UInt = __LINE__) {
XCTAssertEqual(string, "Awesome", file: file, line: line)
}Ideally, the typealias wouldn't be necessary.