From e02f8dc44ce329136a7beea6a66abde4f7ee0e5b Mon Sep 17 00:00:00 2001 From: YR Chen <stevapple@icloud.com> Date: Tue, 23 Aug 2022 05:19:55 +0800 Subject: [PATCH] [PkgConfig] Add test case for dummy dependency --- .../PackageLoadingTests/PkgConfigParserTests.swift | 14 ++++++++++++++ .../pkgconfigInputs/dummy_dependency.pc | 7 +++++++ 2 files changed, 21 insertions(+) create mode 100644 Tests/PackageLoadingTests/pkgconfigInputs/dummy_dependency.pc diff --git a/Tests/PackageLoadingTests/PkgConfigParserTests.swift b/Tests/PackageLoadingTests/PkgConfigParserTests.swift index ddb9df983f3..24f2ec162b6 100644 --- a/Tests/PackageLoadingTests/PkgConfigParserTests.swift +++ b/Tests/PackageLoadingTests/PkgConfigParserTests.swift @@ -105,6 +105,20 @@ final class PkgConfigParserTests: XCTestCase { } } + func testDummyDependency() { + try! loadPCFile("dummy_dependency.pc") { parser in + XCTAssertEqual(parser.variables, [ + "prefix": "/usr/local/bin", + "exec_prefix": "/usr/local/bin", + "pcfiledir": parser.pcFile.parentDirectory.pathString, + "pc_sysrootdir": AbsolutePath.root.pathString + ]) + XCTAssertEqual(parser.dependencies, ["pango", "fontconfig"]) + XCTAssertEqual(parser.cFlags, []) + XCTAssertEqual(parser.libs, ["-L/usr/local/bin", "-lpangoft2-1.0"]) + } + } + /// Test custom search path get higher priority for locating pc files. func testCustomPcFileSearchPath() throws { let observability = ObservabilitySystem.makeForTesting() diff --git a/Tests/PackageLoadingTests/pkgconfigInputs/dummy_dependency.pc b/Tests/PackageLoadingTests/pkgconfigInputs/dummy_dependency.pc new file mode 100644 index 00000000000..c4ae253c81a --- /dev/null +++ b/Tests/PackageLoadingTests/pkgconfigInputs/dummy_dependency.pc @@ -0,0 +1,7 @@ +prefix=/usr/local/bin +exec_prefix=${prefix} + +#some comment + +Requires: pango, , fontconfig >= 2.13.0 +Libs:-L${prefix} -lpangoft2-1.0