Skip to content

Commit 24fc4d6

Browse files
authored
Merge pull request #858 from ahoppen/windows-5
Make tests pass using Swift 5.9 and Swift 5.10 on Windows
2 parents 29197fe + 8f4f6e2 commit 24fc4d6

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

Tests/SwiftFormatTests/Rules/LintOrFormatRuleTestCase.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class LintOrFormatRuleTestCase: DiagnosingTestCase {
5555
syntax: sourceFileSyntax,
5656
source: unmarkedSource,
5757
operatorTable: OperatorTable.standardOperators,
58-
assumingFileURL: URL(string: file.description)!
58+
assumingFileURL: URL(fileURLWithPath: file.description)
5959
)
6060

6161
// Check that pipeline produces the expected findings

Tests/SwiftFormatTests/Utilities/FileIteratorTests.swift

+12-3
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,20 @@ final class FileIteratorTests: XCTestCase {
2424
try FileManager.default.removeItem(at: tmpdir)
2525
}
2626

27-
func testNoFollowSymlinks() {
27+
func testNoFollowSymlinks() throws {
28+
#if os(Windows) && compiler(<5.10)
29+
try XCTSkipIf(true, "Foundation does not follow symlinks on Windows")
30+
#endif
2831
let seen = allFilesSeen(iteratingOver: [tmpdir], followSymlinks: false)
2932
XCTAssertEqual(seen.count, 2)
3033
XCTAssertTrue(seen.contains { $0.hasSuffix("project/real1.swift") })
3134
XCTAssertTrue(seen.contains { $0.hasSuffix("project/real2.swift") })
3235
}
3336

34-
func testFollowSymlinks() {
37+
func testFollowSymlinks() throws {
38+
#if os(Windows) && compiler(<5.10)
39+
try XCTSkipIf(true, "Foundation does not follow symlinks on Windows")
40+
#endif
3541
let seen = allFilesSeen(iteratingOver: [tmpdir], followSymlinks: true)
3642
XCTAssertEqual(seen.count, 3)
3743
XCTAssertTrue(seen.contains { $0.hasSuffix("project/real1.swift") })
@@ -40,7 +46,10 @@ final class FileIteratorTests: XCTestCase {
4046
XCTAssertTrue(seen.contains { $0.hasSuffix("project/.hidden.swift") })
4147
}
4248

43-
func testTraversesHiddenFilesIfExplicitlySpecified() {
49+
func testTraversesHiddenFilesIfExplicitlySpecified() throws {
50+
#if os(Windows) && compiler(<5.10)
51+
try XCTSkipIf(true, "Foundation does not follow symlinks on Windows")
52+
#endif
4453
let seen = allFilesSeen(
4554
iteratingOver: [tmpURL("project/.build"), tmpURL("project/.hidden.swift")],
4655
followSymlinks: false

0 commit comments

Comments
 (0)