@@ -26,6 +26,20 @@ final class NonincrementalCompilationTests: XCTestCase {
2626
2727 try XCTAssertEqual ( buildRecord. buildTime,
2828 Date ( legacyDriverSecsAndNanos: [ 1570318779 , 32358000 ] ) )
29+ #if os(Windows)
30+ try XCTAssertEqual ( buildRecord. inputInfos,
31+ [
32+ VirtualPath ( path: " C: \\ AS \\ repos \\ swift-driver \\ sandbox \\ sandbox \\ sandbox \\ file2.swift " ) :
33+ InputInfo ( status: . needsCascadingBuild,
34+ previousModTime: Date ( legacyDriverSecsAndNanos: [ 1570318778 , 0 ] ) ) ,
35+ VirtualPath ( path: " C: \\ AS \\ repos \\ swift-driver \\ sandbox \\ sandbox \\ sandbox \\ main.swift " ) :
36+ InputInfo ( status: . upToDate,
37+ previousModTime: Date ( legacyDriverSecsAndNanos: [ 1570083660 , 0 ] ) ) ,
38+ VirtualPath ( path: " E: \\ gazorp.swift " ) :
39+ InputInfo ( status: . needsNonCascadingBuild,
40+ previousModTime: Date ( legacyDriverSecsAndNanos: [ 0 , 0 ] ) )
41+ ] )
42+ #else
2943 try XCTAssertEqual ( buildRecord. inputInfos,
3044 [
3145 VirtualPath ( path: " /Volumes/AS/repos/swift-driver/sandbox/sandbox/sandbox/file2.swift " ) :
@@ -38,6 +52,7 @@ final class NonincrementalCompilationTests: XCTestCase {
3852 InputInfo ( status: . needsNonCascadingBuild,
3953 previousModTime: Date ( legacyDriverSecsAndNanos: [ 0 , 0 ] ) )
4054 ] )
55+ #endif
4156 }
4257
4358 func testBuildRecordWithoutOptionsReading( ) throws {
@@ -51,18 +66,33 @@ final class NonincrementalCompilationTests: XCTestCase {
5166
5267 try XCTAssertEqual ( buildRecord. buildTime,
5368 Date ( legacyDriverSecsAndNanos: [ 1570318779 , 32358000 ] ) )
69+ #if os(Windows)
5470 try XCTAssertEqual ( buildRecord. inputInfos,
5571 [
56- VirtualPath ( path: " /Volumes/AS/ repos/ swift-driver/ sandbox/ sandbox/ sandbox/ file2.swift" ) :
72+ VirtualPath ( path: " C: \\ repos \\ swift-driver \\ sandbox \\ sandbox \\ sandbox \\ file2.swift " ) :
5773 InputInfo ( status: . needsCascadingBuild,
5874 previousModTime: Date ( legacyDriverSecsAndNanos: [ 1570318778 , 0 ] ) ) ,
75+ VirtualPath ( path: " C: \\ repos \\ swift-driver \\ sandbox \\ sandbox \\ sandbox \\ main.swift " ) :
76+ InputInfo ( status: . upToDate,
77+ previousModTime: Date ( legacyDriverSecsAndNanos: [ 1570083660 , 0 ] ) ) ,
78+ VirtualPath ( path: " E: \\ gazorp.swift " ) :
79+ InputInfo ( status: . needsNonCascadingBuild,
80+ previousModTime: Date ( legacyDriverSecsAndNanos: [ 0 , 0 ] ) )
81+ ] )
82+ #else
83+ try XCTAssertEqual ( buildRecord. inputInfos,
84+ [
85+ VirtualPath ( path: " /Volumes/AS/repos/swift-driver/sandbox/sandbox/sandbox/file2.swift " ) :
86+ InputInfo ( status: . needsCascadingBuild,
87+ previousModTime: Date ( legacyDriverSecsAndNanos: [ 1570318778 , 0 ] ) ) ,
5988 VirtualPath ( path: " /Volumes/AS/repos/swift-driver/sandbox/sandbox/sandbox/main.swift " ) :
6089 InputInfo ( status: . upToDate,
6190 previousModTime: Date ( legacyDriverSecsAndNanos: [ 1570083660 , 0 ] ) ) ,
6291 VirtualPath ( path: " /Volumes/gazorp.swift " ) :
6392 InputInfo ( status: . needsNonCascadingBuild,
6493 previousModTime: Date ( legacyDriverSecsAndNanos: [ 0 , 0 ] ) )
65- ] )
94+ ] )
95+ #endif
6696 }
6797
6898 func testReadBinarySourceFileDependencyGraph( ) throws {
@@ -151,7 +181,11 @@ final class NonincrementalCompilationTests: XCTestCase {
151181 XCTAssertFalse ( foundEdge)
152182 foundEdge = true
153183
184+ #if os(Windows)
185+ XCTAssertEqual ( defName, " C: \\ Users \\ owenvoorhees \\ Desktop \\ hello.swiftdeps " )
186+ #else
154187 XCTAssertEqual ( defName, " /Users/owenvoorhees/Desktop/hello.swiftdeps " )
188+ #endif
155189 XCTAssertEqual ( defNode. fingerprint, " 38b457b424090ac2e595be0e5f7e3b5b " )
156190
157191 XCTAssertEqual ( useContext, " 5hello1AC " )
@@ -202,9 +236,15 @@ final class NonincrementalCompilationTests: XCTestCase {
202236 func testReadAndWriteBuildRecord( ) throws {
203237 let version = " Apple Swift version 5.1 (swiftlang-1100.0.270.13 clang-1100.0.33.7) "
204238 let options = " abbbfbcaf36b93e58efaadd8271ff142 "
239+ #if os(Windows)
240+ let file2 = " C: \\ repos \\ swift-driver \\ sandbox \\ sandbox \\ sandbox \\ file2.swift "
241+ let main = " C: \\ repos \\ swift-driver \\ sandbox \\ sandbox \\ sandbox \\ main.swift "
242+ let gazorp = " E: \\ gazorp.swift "
243+ #else
205244 let file2 = " /Volumes/AS/repos/swift-driver/sandbox/sandbox/sandbox/file2.swift "
206245 let main = " /Volumes/AS/repos/swift-driver/sandbox/sandbox/sandbox/main.swift "
207246 let gazorp = " /Volumes/gazorp.swift "
247+ #endif
208248 let inputString =
209249 """
210250 version: " \( version) "
@@ -712,7 +752,11 @@ final class IncrementalCompilationTests: XCTestCase {
712752
713753 private func replace( contentsOf name: String , with replacement: String ) {
714754 print ( " *** replacing \( name) *** " , to: & stderrStream) ; stderrStream. flush ( )
715- let path = try ! XCTUnwrap ( inputPathsAndContents. filter { $0. 0 . pathString. contains ( " / " + name + " .swift " ) } . first) . 0
755+ #if os(Windows)
756+ let path = try ! XCTUnwrap ( inputPathsAndContents. filter { $0. 0 . pathString. contains ( " \\ \( name) .swift " ) } . first) . 0
757+ #else
758+ let path = try ! XCTUnwrap ( inputPathsAndContents. filter { $0. 0 . pathString. contains ( " / \( name) .swift " ) } . first) . 0
759+ #endif
716760 let previousContents = try ! localFileSystem. readFileContents ( path) . cString
717761 try ! localFileSystem. writeFileContents ( path) { $0 <<< replacement }
718762 let newContents = try ! localFileSystem. readFileContents ( path) . cString
0 commit comments