Skip to content

Fix FreeBSD tests #1122

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ extension FileManager {
}

private struct DelegateCaptures : Equatable, Sendable {
struct Operation : Equatable, CustomStringConvertible {
struct Operation : Equatable, CustomStringConvertible, Comparable {
let src: String
let dst: String?

Expand All @@ -45,6 +45,10 @@ private struct DelegateCaptures : Equatable, Sendable {
"'\(src)'"
}
}

static func <(lhs: Operation, rhs: Operation) -> Bool {
lhs.src < rhs.src || lhs.dst == nil || (rhs.dst != nil && lhs.dst! < rhs.dst!)
}

init(_ src: String, _ dst: String? = nil) {
self.src = src
Expand Down Expand Up @@ -509,7 +513,9 @@ final class FileManagerTests : XCTestCase {
#if os(Windows)
XCTAssertEqual($0.delegateCaptures.shouldCopy, [.init("dir", "dir2"), .init("dir/bar", "dir2/bar"), .init("dir/foo", "dir2/foo")])
#else
XCTAssertEqual($0.delegateCaptures.shouldCopy, [.init("dir", "dir2"), .init("dir/foo", "dir2/foo"), .init("dir/bar", "dir2/bar")])
var shouldCopy = $0.delegateCaptures.shouldCopy
XCTAssertEqual(shouldCopy.removeFirst(), .init("dir", "dir2"))
XCTAssertEqual(shouldCopy.sorted(), [.init("dir/foo", "dir2/foo"), .init("dir/bar", "dir2/bar")].sorted())

// Specifically for non-Windows (where copying directory metadata takes a special path) double check that the metadata was copied exactly
XCTAssertEqual(try $0.attributesOfItem(atPath: "dir2")[.posixPermissions] as? UInt, 0o777)
Expand Down
2 changes: 1 addition & 1 deletion Tests/FoundationEssentialsTests/ProcessInfoTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ final class ProcessInfoTests : XCTestCase {
func testProcessName() {
#if FOUNDATION_FRAMEWORK
let targetName = "TestHost"
#elseif os(Linux) || os(Windows) || os(Android)
#elseif os(Linux) || os(Windows) || os(Android) || os(FreeBSD)
let targetName = "swift-foundationPackageTests.xctest"
#else
let targetName = "xctest"
Expand Down