Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests: Address warnings about unused results and variables #1421

Merged
merged 2 commits into from Aug 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 2 additions & 11 deletions Tests/SwiftDriverTests/DependencyGraphSerializationTests.swift
Expand Up @@ -27,12 +27,7 @@ class DependencyGraphSerializationTests: XCTestCase, ModuleDependencyGraphMocker
let graph = Self.mockGraphCreator.mockUpAGraph()
let currentVersion = ModuleDependencyGraph.serializedGraphVersion
let alteredVersion = currentVersion.withAlteredMinor
let outputFileMap = OutputFileMap.mock(maxIndex: Self.maxIndex)
let diagnosticsEngine = DiagnosticsEngine()
let info = BuildRecordInfo.mock(
diagnosticEngine: diagnosticsEngine,
outputFileMap: outputFileMap,
compilerVersion: "Swift 99")

try graph.blockingConcurrentAccessOrMutation {
try graph.write(
to: mockPath,
Expand Down Expand Up @@ -63,11 +58,7 @@ class DependencyGraphSerializationTests: XCTestCase, ModuleDependencyGraphMocker
let mockPath = try VirtualPath.absolute(AbsolutePath(validating: "/module-dependency-graph"))
let fs = InMemoryFileSystem()
let outputFileMap = OutputFileMap.mock(maxIndex: Self.maxIndex)
let diagnosticsEngine = DiagnosticsEngine()
let buildRecord = BuildRecordInfo.mock(
diagnosticEngine: diagnosticsEngine,
outputFileMap: outputFileMap,
compilerVersion: "Swift 99")

try originalGraph.blockingConcurrentMutation {
try originalGraph.write(
to: mockPath, on: fs,
Expand Down
23 changes: 0 additions & 23 deletions Tests/SwiftDriverTests/ExplicitModuleBuildTests.swift
Expand Up @@ -73,29 +73,6 @@ private func checkExplicitModuleBuildJobDependencies(job: Job,
moduleInfo : ModuleInfo,
dependencyGraph: InterModuleDependencyGraph
) throws {
var validateModuleMapCommandLineDependency: (ModuleDependencyId, ModuleInfo) throws -> Void = { dependencyId, dependencyInfo in
// Load the dependency JSON and verify this dependency was encoded correctly
let explicitDepsFlag =
SwiftDriver.Job.ArgTemplate.flag(String("-explicit-swift-module-map-file"))
XCTAssert(job.commandLine.contains(explicitDepsFlag))
let jsonDepsPathIndex = job.commandLine.firstIndex(of: explicitDepsFlag)
let jsonDepsPathArg = job.commandLine[jsonDepsPathIndex! + 1]
guard case .path(let jsonDepsPath) = jsonDepsPathArg else {
XCTFail("No JSON dependency file path found.")
return
}
guard case let .temporaryWithKnownContents(_, contents) = jsonDepsPath else {
XCTFail("Unexpected path type")
return
}
let dependencyInfoList = try JSONDecoder().decode(Array<SwiftModuleArtifactInfo>.self,
from: contents)
let dependencyArtifacts =
dependencyInfoList.first(where:{ $0.moduleName == dependencyId.moduleName })
XCTAssertEqual(dependencyArtifacts!.modulePath, dependencyInfo.modulePath)
}


let validateSwiftCommandLineDependency: (ModuleDependencyId, ModuleInfo) -> Void = { dependencyId, dependencyInfo in
let inputModulePath = dependencyInfo.modulePath.path
XCTAssertTrue(job.inputs.contains(TypedVirtualPath(file: inputModulePath, type: .swiftModule)))
Expand Down
4 changes: 2 additions & 2 deletions Tests/SwiftDriverTests/SwiftDriverTests.swift
Expand Up @@ -6863,8 +6863,8 @@ final class SwiftDriverTests: XCTestCase {
let jobs = try driver.planBuild().removingAutolinkExtractJobs()
XCTAssertEqual(jobs.count, 2)
let (compileJob, linkJob) = (jobs[0], jobs[1])
compileJob.commandLine.contains(.flag("--gcc-toolchain=foo/as/blarpy"))
linkJob.commandLine.contains(.flag("--gcc-toolchain=foo/as/blarpy"))
XCTAssert(compileJob.commandLine.contains(.flag("--gcc-toolchain=foo/as/blarpy")))
XCTAssert(linkJob.commandLine.contains(.flag("--gcc-toolchain=foo/as/blarpy")))
}

func testPluginPaths() throws {
Expand Down