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 {
480480 // https://github.com/swiftlang/swift-format/issues/844
481481 return self . pathComponents. count == 1
482482 #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 == " "
484486 #endif
485487 }
486488}
Original file line number Diff line number Diff line change @@ -26,4 +26,21 @@ final class ConfigurationTests: XCTestCase {
2626 #endif
2727 XCTAssertNil ( Configuration . url ( forConfigurationFileApplyingTo: URL ( fileURLWithPath: path) ) )
2828 }
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+ }
2946}
You can’t perform that action at this time.
0 commit comments