Skip to content

Commit 1c18141

Browse files
committed
Add tests for symbol graph flag propagation
1 parent 2792b92 commit 1c18141

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

Tests/SwiftDriverTests/SwiftDriverTests.swift

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3525,6 +3525,32 @@ final class SwiftDriverTests: XCTestCase {
35253525
}
35263526
}
35273527

3528+
func testEmitSymbolGraphPrettyPrint() throws {
3529+
do {
3530+
let root = localFileSystem.currentWorkingDirectory!.appending(components: "foo", "bar")
3531+
3532+
var driver = try Driver(args: ["swiftc", "foo.swift", "bar.swift", "-module-name", "Test", "-emit-module-path", rebase("Test.swiftmodule", at: root), "-emit-symbol-graph", "-emit-symbol-graph-dir", "/foo/bar/", "-symbol-graph-pretty-print", "-emit-library"])
3533+
let plannedJobs = try driver.planBuild().removingAutolinkExtractJobs()
3534+
3535+
// We don't know the output file of the symbol graph, just make sure the flag is passed along.
3536+
XCTAssertJobInvocationMatches(plannedJobs[0], .flag("-emit-symbol-graph"))
3537+
XCTAssertJobInvocationMatches(plannedJobs[0], .flag("-symbol-graph-pretty-print"))
3538+
}
3539+
}
3540+
3541+
func testEmitSymbolGraphSkipSynthesizedMembers() throws {
3542+
do {
3543+
let root = localFileSystem.currentWorkingDirectory!.appending(components: "foo", "bar")
3544+
3545+
var driver = try Driver(args: ["swiftc", "foo.swift", "bar.swift", "-module-name", "Test", "-emit-module-path", rebase("Test.swiftmodule", at: root), "-emit-symbol-graph", "-emit-symbol-graph-dir", "/foo/bar/", "-symbol-graph-skip-synthesized-members", "-emit-library"])
3546+
let plannedJobs = try driver.planBuild().removingAutolinkExtractJobs()
3547+
3548+
// We don't know the output file of the symbol graph, just make sure the flag is passed along.
3549+
XCTAssertJobInvocationMatches(plannedJobs[0], .flag("-emit-symbol-graph"))
3550+
XCTAssertJobInvocationMatches(plannedJobs[0], .flag("-symbol-graph-skip-synthesized-members"))
3551+
}
3552+
}
3553+
35283554
func testEmitModuleSeparately() throws {
35293555
var envVars = ProcessEnv.block
35303556
envVars["SWIFT_DRIVER_LD_EXEC"] = ld.nativePathString(escaped: false)

0 commit comments

Comments
 (0)