Skip to content

Commit 1122c3c

Browse files
authored
Followup to increasing swift-build test coverage (#8374)
This is a followup to #8333 based on feedback from there.
1 parent 8268261 commit 1122c3c

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

Tests/CommandsTests/BuildCommandTests.swift

+11-2
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,12 @@ class BuildCommandTestCases: CommandsBuildProviderTestCase {
108108
XCTAssertMatch(stdout, .contains("SEE ALSO: swift run, swift package, swift test"))
109109
}
110110

111+
func testCommandDoesNotEmitDuplicateSymbols() async throws {
112+
let (stdout, stderr) = try await SwiftPM.Build.execute(["--help"])
113+
XCTAssertNoMatch(stdout, duplicateSymbolRegex)
114+
XCTAssertNoMatch(stderr, duplicateSymbolRegex)
115+
}
116+
111117
func testVersion() async throws {
112118
let stdout = try await execute(["--version"]).stdout
113119
XCTAssertMatch(stdout, .regex(#"Swift Package Manager -( \w+ )?\d+.\d+.\d+(-\w+)?"#))
@@ -202,12 +208,15 @@ class BuildCommandTestCases: CommandsBuildProviderTestCase {
202208
)
203209

204210
guard buildSystemProvider == .xcode || buildSystemProvider == .swiftbuild else {
211+
// The remainder of this test only applies to XCBuild or Swift Build
205212
return
206213
}
207214

208215
// Print correct path when building with XCBuild or Swift Build
209-
let xcodeDebugOutput = try await execute(["--show-bin-path"], packagePath: fullPath)
210-
.stdout
216+
let xcodeDebugOutput = try await execute(
217+
["-c", "debug", "--show-bin-path"],
218+
packagePath: fullPath)
219+
.stdout
211220
let xcodeReleaseOutput = try await execute(
212221
["-c", "release", "--show-bin-path"],
213222
packagePath: fullPath

Tests/CommandsTests/PackageCommandTests.swift

+6-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ class PackageCommandTestCase: CommandsBuildProviderTestCase {
4545
var environment = env ?? [:]
4646
// don't ignore local packages when caching
4747
environment["SWIFTPM_TESTS_PACKAGECACHE"] = "1"
48-
// return try await self.execute(args, packagePath: packagePath, env: environment)
4948
return try await executeSwiftPackage(
5049
packagePath,
5150
extraArgs: args,
@@ -77,6 +76,12 @@ class PackageCommandTestCase: CommandsBuildProviderTestCase {
7776
XCTAssertMatch(stdout, .contains("SEE ALSO: swift build, swift run, swift test"))
7877
}
7978

79+
func testCommandDoesNotEmitDuplicateSymbols() async throws {
80+
let (stdout, stderr) = try await SwiftPM.Package.execute(["--help"])
81+
XCTAssertNoMatch(stdout, duplicateSymbolRegex)
82+
XCTAssertNoMatch(stderr, duplicateSymbolRegex)
83+
}
84+
8085
func testVersion() async throws {
8186
// This test fails when `--build-system <system>` is provided, so directly invoke SwiftPM.Package.execute
8287
let stdout = try await SwiftPM.Package.execute(["--version"]).stdout

0 commit comments

Comments
 (0)