Skip to content

Commit 4cd3c7c

Browse files
committed
Fix Linux/Windows build failures
1 parent 1e12dde commit 4cd3c7c

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

Tests/FoundationEssentialsTests/FileManager/FileManagerTests.swift

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -774,27 +774,27 @@ private struct FileManagerTests {
774774
"foo"
775775
}
776776
"bar"
777-
}.test {
778-
#expect(try $0.subpathsOfDirectory(atPath: ".").sorted() == ["bar", "dir", "dir/foo"])
779-
#expect($0.changeCurrentDirectoryPath("dir"))
780-
#expect(try $0.subpathsOfDirectory(atPath: ".") == ["foo"])
781-
#expect(!$0.changeCurrentDirectoryPath("foo"))
782-
#expect($0.changeCurrentDirectoryPath(".."))
783-
#expect(try $0.subpathsOfDirectory(atPath: ".").sorted() == ["bar", "dir", "dir/foo"])
784-
#expect(!$0.changeCurrentDirectoryPath("does_not_exist"))
777+
}.test { fileManager in
778+
#expect(try fileManager.subpathsOfDirectory(atPath: ".").sorted() == ["bar", "dir", "dir/foo"])
779+
#expect(fileManager.changeCurrentDirectoryPath("dir"))
780+
#expect(try fileManager.subpathsOfDirectory(atPath: ".") == ["foo"])
781+
#expect(!fileManager.changeCurrentDirectoryPath("foo"))
782+
#expect(fileManager.changeCurrentDirectoryPath(".."))
783+
#expect(try fileManager.subpathsOfDirectory(atPath: ".").sorted() == ["bar", "dir", "dir/foo"])
784+
#expect(!fileManager.changeCurrentDirectoryPath("does_not_exist"))
785785

786786
// Test get current directory path when it's parent directory was removed.
787-
#expect($0.changeCurrentDirectoryPath("dir"))
787+
#expect(fileManager.changeCurrentDirectoryPath("dir"))
788788
#if os(Windows)
789789
// Removing the current working directory fails on Windows because the directory is in use.
790790
#expect {
791-
try $0.removeItem(atPath: $0.currentDirectoryPath)
791+
try fileManager.removeItem(atPath: $0.currentDirectoryPath)
792792
} throws: {
793793
($0 as? CocoaError)?.code == .fileWriteNoPermission
794794
}
795795
#else
796-
try $0.removeItem(atPath: $0.currentDirectoryPath)
797-
#expect($0.currentDirectoryPath == "")
796+
try fileManager.removeItem(atPath: fileManager.currentDirectoryPath)
797+
#expect(fileManager.currentDirectoryPath == "")
798798
#endif
799799
}
800800
}
@@ -1010,7 +1010,7 @@ private struct FileManagerTests {
10101010
#if canImport(Darwin) || os(Windows)
10111011
@Test(.disabled("This test is not applicable on this platform"))
10121012
#else
1013-
@Test(.disabled(if: ProcessInfo.processInfo.environment.keys.first(where: { $0.starts(with: "XDG") }), "Skipping due to presence of XDG environment variables which may affect this test"))
1013+
@Test(.disabled(if: ProcessInfo.processInfo.environment.keys.contains(where: { $0.starts(with: "XDG") }), "Skipping due to presence of XDG environment variables which may affect this test"))
10141014
#endif
10151015
func searchPaths_XDGEnvironmentVariables() async throws {
10161016
try await FilePlayground {

0 commit comments

Comments
 (0)