@@ -3640,13 +3640,56 @@ final class SwiftDriverTests: XCTestCase {
3640
3640
XCTAssertTrue ( verifyJob. outputs. isEmpty)
3641
3641
XCTAssertTrue ( verifyJob. commandLine. contains ( . path( mergeInterfaceOutputs [ 0 ] . file) ) )
3642
3642
}
3643
+
3643
3644
// No Evolution
3644
3645
do {
3645
3646
var driver = try Driver ( args: [ " swiftc " , " foo.swift " , " -emit-module " , " -module-name " ,
3646
3647
" foo " , " -emit-module-interface " , " -verify-emitted-module-interface " ] )
3647
3648
let plannedJobs = try driver. planBuild ( )
3648
3649
XCTAssertEqual ( plannedJobs. count, 2 )
3649
3650
}
3651
+
3652
+ // Emit-module separately
3653
+ do {
3654
+ var driver = try Driver ( args: [ " swiftc " , " foo.swift " , " -emit-module " , " -module-name " ,
3655
+ " foo " , " -emit-module-interface " ,
3656
+ " -verify-emitted-module-interface " ,
3657
+ " -enable-library-evolution " ,
3658
+ " -experimental-emit-module-separately " ] )
3659
+ let plannedJobs = try driver. planBuild ( )
3660
+ XCTAssertEqual ( plannedJobs. count, 2 )
3661
+ let emitJob = plannedJobs [ 0 ]
3662
+ let verifyJob = plannedJobs [ 1 ]
3663
+ XCTAssertEqual ( emitJob. kind, . emitModule)
3664
+ let emitInterfaceOutput = emitJob. outputs. filter { $0. type == . swiftInterface }
3665
+ XCTAssertTrue ( emitInterfaceOutput. count == 1 ,
3666
+ " Emit module job should only have one swiftinterface output " )
3667
+ XCTAssertEqual ( verifyJob. kind, . verifyModuleInterface)
3668
+ XCTAssertTrue ( verifyJob. inputs. count == 1 )
3669
+ XCTAssertTrue ( verifyJob. inputs [ 0 ] == emitInterfaceOutput [ 0 ] )
3670
+ XCTAssertTrue ( verifyJob. commandLine. contains ( . path( emitInterfaceOutput [ 0 ] . file) ) )
3671
+ }
3672
+
3673
+ // Whole-module
3674
+ do {
3675
+ var driver = try Driver ( args: [ " swiftc " , " foo.swift " , " -emit-module " , " -module-name " ,
3676
+ " foo " , " -emit-module-interface " ,
3677
+ " -verify-emitted-module-interface " ,
3678
+ " -enable-library-evolution " ,
3679
+ " -whole-module-optimization " ] )
3680
+ let plannedJobs = try driver. planBuild ( )
3681
+ XCTAssertEqual ( plannedJobs. count, 2 )
3682
+ let emitJob = plannedJobs [ 0 ]
3683
+ let verifyJob = plannedJobs [ 1 ]
3684
+ XCTAssertEqual ( emitJob. kind, . compile)
3685
+ let emitInterfaceOutput = emitJob. outputs. filter { $0. type == . swiftInterface }
3686
+ XCTAssertTrue ( emitInterfaceOutput. count == 1 ,
3687
+ " Emit module job should only have one swiftinterface output " )
3688
+ XCTAssertEqual ( verifyJob. kind, . verifyModuleInterface)
3689
+ XCTAssertTrue ( verifyJob. inputs. count == 1 )
3690
+ XCTAssertTrue ( verifyJob. inputs [ 0 ] == emitInterfaceOutput [ 0 ] )
3691
+ XCTAssertTrue ( verifyJob. commandLine. contains ( . path( emitInterfaceOutput [ 0 ] . file) ) )
3692
+ }
3650
3693
}
3651
3694
3652
3695
func testPCHGeneration( ) throws {
0 commit comments