Skip to content

Commit e5b7226

Browse files
authored
Merge pull request #1421 from tshortli/address-warnings-in-tests
Tests: Address warnings about unused results and variables
2 parents 56f498f + 88b4a7c commit e5b7226

File tree

3 files changed

+4
-36
lines changed

3 files changed

+4
-36
lines changed

Tests/SwiftDriverTests/DependencyGraphSerializationTests.swift

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,7 @@ class DependencyGraphSerializationTests: XCTestCase, ModuleDependencyGraphMocker
2727
let graph = Self.mockGraphCreator.mockUpAGraph()
2828
let currentVersion = ModuleDependencyGraph.serializedGraphVersion
2929
let alteredVersion = currentVersion.withAlteredMinor
30-
let outputFileMap = OutputFileMap.mock(maxIndex: Self.maxIndex)
31-
let diagnosticsEngine = DiagnosticsEngine()
32-
let info = BuildRecordInfo.mock(
33-
diagnosticEngine: diagnosticsEngine,
34-
outputFileMap: outputFileMap,
35-
compilerVersion: "Swift 99")
30+
3631
try graph.blockingConcurrentAccessOrMutation {
3732
try graph.write(
3833
to: mockPath,
@@ -63,11 +58,7 @@ class DependencyGraphSerializationTests: XCTestCase, ModuleDependencyGraphMocker
6358
let mockPath = try VirtualPath.absolute(AbsolutePath(validating: "/module-dependency-graph"))
6459
let fs = InMemoryFileSystem()
6560
let outputFileMap = OutputFileMap.mock(maxIndex: Self.maxIndex)
66-
let diagnosticsEngine = DiagnosticsEngine()
67-
let buildRecord = BuildRecordInfo.mock(
68-
diagnosticEngine: diagnosticsEngine,
69-
outputFileMap: outputFileMap,
70-
compilerVersion: "Swift 99")
61+
7162
try originalGraph.blockingConcurrentMutation {
7263
try originalGraph.write(
7364
to: mockPath, on: fs,

Tests/SwiftDriverTests/ExplicitModuleBuildTests.swift

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -73,29 +73,6 @@ private func checkExplicitModuleBuildJobDependencies(job: Job,
7373
moduleInfo : ModuleInfo,
7474
dependencyGraph: InterModuleDependencyGraph
7575
) throws {
76-
var validateModuleMapCommandLineDependency: (ModuleDependencyId, ModuleInfo) throws -> Void = { dependencyId, dependencyInfo in
77-
// Load the dependency JSON and verify this dependency was encoded correctly
78-
let explicitDepsFlag =
79-
SwiftDriver.Job.ArgTemplate.flag(String("-explicit-swift-module-map-file"))
80-
XCTAssert(job.commandLine.contains(explicitDepsFlag))
81-
let jsonDepsPathIndex = job.commandLine.firstIndex(of: explicitDepsFlag)
82-
let jsonDepsPathArg = job.commandLine[jsonDepsPathIndex! + 1]
83-
guard case .path(let jsonDepsPath) = jsonDepsPathArg else {
84-
XCTFail("No JSON dependency file path found.")
85-
return
86-
}
87-
guard case let .temporaryWithKnownContents(_, contents) = jsonDepsPath else {
88-
XCTFail("Unexpected path type")
89-
return
90-
}
91-
let dependencyInfoList = try JSONDecoder().decode(Array<SwiftModuleArtifactInfo>.self,
92-
from: contents)
93-
let dependencyArtifacts =
94-
dependencyInfoList.first(where:{ $0.moduleName == dependencyId.moduleName })
95-
XCTAssertEqual(dependencyArtifacts!.modulePath, dependencyInfo.modulePath)
96-
}
97-
98-
9976
let validateSwiftCommandLineDependency: (ModuleDependencyId, ModuleInfo) -> Void = { dependencyId, dependencyInfo in
10077
let inputModulePath = dependencyInfo.modulePath.path
10178
XCTAssertTrue(job.inputs.contains(TypedVirtualPath(file: inputModulePath, type: .swiftModule)))

Tests/SwiftDriverTests/SwiftDriverTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6863,8 +6863,8 @@ final class SwiftDriverTests: XCTestCase {
68636863
let jobs = try driver.planBuild().removingAutolinkExtractJobs()
68646864
XCTAssertEqual(jobs.count, 2)
68656865
let (compileJob, linkJob) = (jobs[0], jobs[1])
6866-
compileJob.commandLine.contains(.flag("--gcc-toolchain=foo/as/blarpy"))
6867-
linkJob.commandLine.contains(.flag("--gcc-toolchain=foo/as/blarpy"))
6866+
XCTAssert(compileJob.commandLine.contains(.flag("--gcc-toolchain=foo/as/blarpy")))
6867+
XCTAssert(linkJob.commandLine.contains(.flag("--gcc-toolchain=foo/as/blarpy")))
68686868
}
68696869

68706870
func testPluginPaths() throws {

0 commit comments

Comments
 (0)