Skip to content

Commit 4fed86c

Browse files
authored
Add missing unit test for #2891 (#3140)
We merged that PR without a unit test, this adds one. rdar://68158441
1 parent 674feb7 commit 4fed86c

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

Tests/XCBuildSupportTests/PIFBuilderTests.swift

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1456,6 +1456,57 @@ class PIFBuilderTests: XCTestCase {
14561456
}
14571457
}
14581458
}
1459+
1460+
func testLibraryTargetWithModuleMap() throws {
1461+
let fs = InMemoryFileSystem(emptyFiles:
1462+
"/Bar/Sources/BarLib/lib.c",
1463+
"/Bar/Sources/BarLib/module.modulemap"
1464+
)
1465+
1466+
let diagnostics = DiagnosticsEngine()
1467+
let graph = try loadPackageGraph(
1468+
fs: fs,
1469+
diagnostics: diagnostics,
1470+
manifests: [
1471+
Manifest.createManifest(
1472+
name: "Bar",
1473+
path: "/Bar",
1474+
url: "/Bar",
1475+
v: .v4_2,
1476+
packageKind: .root,
1477+
cLanguageStandard: "c11",
1478+
swiftLanguageVersions: [.v4_2],
1479+
products: [
1480+
.init(name: "BarLib", type: .library(.dynamic), targets: ["BarLib"]),
1481+
],
1482+
targets: [
1483+
.init(name: "BarLib"),
1484+
]),
1485+
]
1486+
)
1487+
1488+
var pif: PIF.TopLevelObject!
1489+
try! withCustomEnv(["PKG_CONFIG_PATH": inputsDir.pathString]) {
1490+
let builder = PIFBuilder(graph: graph, parameters: .mock(shouldCreateDylibForDynamicProducts: true), diagnostics: diagnostics)
1491+
pif = try builder.construct()
1492+
}
1493+
1494+
XCTAssertNoDiagnostics(diagnostics)
1495+
1496+
PIFTester(pif) { workspace in
1497+
workspace.checkProject("PACKAGE:/Bar") { project in
1498+
project.checkTarget("PACKAGE-PRODUCT:BarLib") { target in
1499+
XCTAssertEqual(target.name, "BarLib")
1500+
1501+
target.checkBuildConfiguration("Debug") { configuration in
1502+
configuration.checkBuildSettings { settings in
1503+
XCTAssertNil(settings[.MODULEMAP_FILE_CONTENTS])
1504+
}
1505+
}
1506+
}
1507+
}
1508+
}
1509+
}
14591510

14601511
func testSystemLibraryTargets() throws {
14611512
let fs = InMemoryFileSystem(emptyFiles:

0 commit comments

Comments
 (0)