File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed
Tests/SwiftFormatTests/API Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -480,7 +480,9 @@ fileprivate extension URL {
480
480
// https://github.com/swiftlang/swift-format/issues/844
481
481
return self . pathComponents. count == 1
482
482
#else
483
- return self . path == " / "
483
+ // On Linux, we may end up with an string for the path due to https://github.com/swiftlang/swift-foundation/issues/980
484
+ // TODO: Remove the check for "" once https://github.com/swiftlang/swift-foundation/issues/980 is fixed.
485
+ return self . path == " / " || self . path == " "
484
486
#endif
485
487
}
486
488
}
Original file line number Diff line number Diff line change @@ -26,4 +26,21 @@ final class ConfigurationTests: XCTestCase {
26
26
#endif
27
27
XCTAssertNil ( Configuration . url ( forConfigurationFileApplyingTo: URL ( fileURLWithPath: path) ) )
28
28
}
29
+
30
+ func testMissingConfigurationFileInSubdirectory( ) {
31
+ #if os(Windows)
32
+ let path = #"C:\whatever\test.swift"#
33
+ #else
34
+ let path = " /whatever/test.swift "
35
+ #endif
36
+ XCTAssertNil ( Configuration . url ( forConfigurationFileApplyingTo: URL ( fileURLWithPath: path) ) )
37
+ }
38
+
39
+ func testMissingConfigurationFileMountedDirectory( ) throws {
40
+ #if !os(Windows)
41
+ try XCTSkipIf ( true , #"\\ file mounts are only a concept on Windows"# )
42
+ #endif
43
+ let path = #"\\mount\test.swift"#
44
+ XCTAssertNil ( Configuration . url ( forConfigurationFileApplyingTo: URL ( fileURLWithPath: path) ) )
45
+ }
29
46
}
You can’t perform that action at this time.
0 commit comments