Skip to content

Commit

Permalink
Make tests buildable with Xcode 7.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
norio-nomura committed Sep 1, 2016
1 parent b4a8d3d commit f6b7840
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Tests/SwiftLintFramework/TestHelpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,19 @@ func cleanedContentsAndMarkerOffsets(from contents: String) -> (String, [Int]) {

extension Configuration {
private func assertCorrection(before: String, expected: String) {
#if swift(>=2.3)
guard let path = NSURL(fileURLWithPath: NSTemporaryDirectory(), isDirectory: true)
.URLByAppendingPathComponent(NSUUID().UUIDString + ".swift")?.path else {
XCTFail("couldn't generate temporary path for assertCorrection()")
return
}
#else
guard let path = NSURL(fileURLWithPath: NSTemporaryDirectory(), isDirectory: true)
.URLByAppendingPathComponent(NSUUID().UUIDString + ".swift").path else {
XCTFail("couldn't generate temporary path for assertCorrection()")
return
}
#endif
let (cleanedBefore, markerOffsets) = cleanedContentsAndMarkerOffsets(from: before)
if cleanedBefore.dataUsingEncoding(NSUTF8StringEncoding)?
.writeToFile(path, atomically: true) != true {
Expand Down

0 comments on commit f6b7840

Please sign in to comment.