Skip to content

test(complete): Add tests for delimited value edge cases#6265

Draft
AndreasBackx wants to merge 1 commit intoclap-rs:masterfrom
AndreasBackx:fix/delimited-values-edge-cases
Draft

test(complete): Add tests for delimited value edge cases#6265
AndreasBackx wants to merge 1 commit intoclap-rs:masterfrom
AndreasBackx:fix/delimited-values-edge-cases

Conversation

@AndreasBackx
Copy link
Copy Markdown
Contributor

@AndreasBackx AndreasBackx commented Feb 13, 2026

This PR was generated with the assistance of an AI agent and reviewed by me.

Related to #3922

Summary

Adds regression test coverage for delimiter-separated value completion edge cases. These tests confirm the existing implementation already handles these scenarios correctly — no code changes were needed.

Tests added

  1. suggest_delimiter_with_allow_hyphen — Verifies value_delimiter + allow_hyphen_values(true) works correctly: hyphen-prefixed values like --special and -s complete properly both as first values and after a delimiter.

  2. suggest_delimiter_positional_multi — Verifies multiple positional arguments each with their own value_delimiter complete independently.

Note

Issue #3922 tracks broader delimiter edge cases. The specific scenarios tested here already work.

This PR adds coverage to prevent regressions as other delimiter-related work lands.

Test plan

  • cargo test -p clap_complete --features unstable-dynamic — all 109 tests pass
  • cargo clippy -p clap_complete --features unstable-dynamic — clean

@AndreasBackx AndreasBackx force-pushed the fix/delimited-values-edge-cases branch from b2588bd to 7da02ad Compare February 13, 2026 01:56
@AndreasBackx AndreasBackx marked this pull request as ready for review February 13, 2026 02:08
@AndreasBackx AndreasBackx marked this pull request as draft February 13, 2026 03:19
}

#[test]
fn suggest_delimiter_with_allow_hyphen() {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is extra tests for value_delimiter, why is it not next to that?

Comment on lines +1484 to +1485
#[test]
fn suggest_delimiter_positional_multi() {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What in particular is the concern this is trying to address?

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.

2 participants