cmds.projects.CmdCreatePkgConfig: Fix Requires lines and add integration test #101
Loading…
Reference in a new issue
No description provided.
Delete branch "jan/fix/20260913-create-pkg-config-requires"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This PR fixes the Requires line generation in create-pkg-config (double commas for comma-separated input, missing trailing newline) and adds an integration test that pins the generated pkg-config file against a reference:
cmds.projects.CmdCreatePkgConfig: Fix Requires lines
__cleanup_requires() replaces every run of whitespace with ", " before re-pairing the version constraints, so input that is already comma-separated, e.g. "jw-core >= 1.0, jw-base", comes out with a double comma, "jw-core >= 1.0,, jw-base". And the Requires line is appended without a trailing newline, so a following Requires.private line runs straight into it.
Split the input on commas and whitespace, treating the version constraint operators as delimiters that are re-paired with the preceding name and the following version, so that comma- and space-separated input alike comes out as a clean ", "-joined list. Add the missing newline after the Requires line.
test/integration/projects/create-pkg-config: Add
create-pkg-config's output is not covered by any test, even though the template and the Requires cleanup produce exact text that pkg-config consumes, so regressions in the generated file went unnoticed for a long time.
Add an integration test that runs create-pkg-config with a full option set, with space- and comma-mixed Requires input, and with a Requires.private-only input, and compares the output against a reference file.