@@ -34,7 +34,7 @@ extension FileManager {
34
34
}
35
35
36
36
private struct DelegateCaptures : Equatable , Sendable {
37
- struct Operation : Equatable , CustomStringConvertible {
37
+ struct Operation : Equatable , CustomStringConvertible , Comparable {
38
38
let src : String
39
39
let dst : String ?
40
40
@@ -45,6 +45,10 @@ private struct DelegateCaptures : Equatable, Sendable {
45
45
" ' \( src) ' "
46
46
}
47
47
}
48
+
49
+ static func < ( lhs: Operation , rhs: Operation ) -> Bool {
50
+ lhs. src < rhs. src || lhs. dst == nil || ( rhs. dst != nil && lhs. dst! < rhs. dst!)
51
+ }
48
52
49
53
init ( _ src: String , _ dst: String ? = nil ) {
50
54
self . src = src
@@ -509,7 +513,9 @@ final class FileManagerTests : XCTestCase {
509
513
#if os(Windows)
510
514
XCTAssertEqual ( $0. delegateCaptures. shouldCopy, [ . init( " dir " , " dir2 " ) , . init( " dir/bar " , " dir2/bar " ) , . init( " dir/foo " , " dir2/foo " ) ] )
511
515
#else
512
- XCTAssertEqual ( $0. delegateCaptures. shouldCopy, [ . init( " dir " , " dir2 " ) , . init( " dir/foo " , " dir2/foo " ) , . init( " dir/bar " , " dir2/bar " ) ] )
516
+ var shouldCopy = $0. delegateCaptures. shouldCopy
517
+ XCTAssertEqual ( shouldCopy. removeFirst ( ) , . init( " dir " , " dir2 " ) )
518
+ XCTAssertEqual ( shouldCopy. sorted ( ) , [ . init( " dir/foo " , " dir2/foo " ) , . init( " dir/bar " , " dir2/bar " ) ] . sorted ( ) )
513
519
514
520
// Specifically for non-Windows (where copying directory metadata takes a special path) double check that the metadata was copied exactly
515
521
XCTAssertEqual ( try $0. attributesOfItem ( atPath: " dir2 " ) [ . posixPermissions] as? UInt , 0o777 )
0 commit comments