Skip to content

Fix tool tests for Swift Build - #996

Open
rgoldberg wants to merge 1 commit into
apple:mainfrom
rgoldberg:995-test-tool-dependencies
Open

rgoldberg wants to merge 1 commit into
apple:mainfrom
rgoldberg:995-test-tool-dependencies

Conversation

@rgoldberg

Copy link
Copy Markdown
Collaborator

Fix tool tests for Swift Build.

Resolve #995

Checklist

  • I've added at least one test that validates that my change is working, if appropriate
  • I've followed the code style of the rest of the project
  • I've read the Contribution Guidelines
  • I've updated the documentation if necessary

Both existing `DefaultAsFlagParsingStrategy` strategies can consume a
following argument, so a `defaultAsFlag` option placed before a
positional argument took that argument as its value.

The new `.attached` strategy accepts a value only when attached to the
option, following the GNU `getopt_long` convention for optional
arguments:

- `--opt` uses the `defaultAsFlag` value and never consumes the next
  argument
- `--opt=value` uses `value`, and `--opt=` uses the empty string
- a short name that allows joined values also accepts `-ovalue`

An invalid attached value is reported as an error instead of falling
back to the `defaultAsFlag` value.

Help renders such an option as `--opt[=<value>]`, error messages as
`--opt=<value>`, and `dump-help` records its parsing strategy as
`attached`. Completion scripts complete it as a flag, since the next
word is never its value.

Resolves apple#992.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Ross Goldberg <484615+rgoldberg@users.noreply.github.com>
@rgoldberg
rgoldberg force-pushed the 995-test-tool-dependencies branch from 13cfb7b to 3877300 Compare October 23, 2026 14:30

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tool tests fail under the Swift Build build system because generate-manual & generate-docc-reference are not built

1 participant