Skip to content

feat(complete): Add structured E2E completion test framework#6263

Draft
AndreasBackx wants to merge 1 commit intoclap-rs:masterfrom
AndreasBackx:feat/e2e-completion-tests
Draft

feat(complete): Add structured E2E completion test framework#6263
AndreasBackx wants to merge 1 commit intoclap-rs:masterfrom
AndreasBackx:feat/e2e-completion-tests

Conversation

@AndreasBackx
Copy link
Contributor

@AndreasBackx AndreasBackx commented Feb 13, 2026

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

Related to #3166

Summary

Adds a reusable e2e_test! macro and 20 PTY-based test cases (5 per shell: Bash, Fish, Zsh, Elvish) that validate tab-completion end-to-end using the exhaustive example binary with dynamic-env completions. Gated behind unstable-shell-tests + unstable-dynamic.

I was trying to see what there was to actually test the real output of shells. But I couldn't really find much besides completest but it seemed like it was unused and documentation was hard to find. 😅️ What should be done to validate real output?

I already think some of this can be moved to snapshots instead of inline as well.

Test plan

  • cargo test -p clap_complete --features unstable-dynamic — no regressions
  • 20 tests discovered with --features unstable-dynamic,unstable-shell-tests -- e2e --list
  • Tests skip gracefully when shells are unavailable

Add a reusable `e2e_test!` macro and 20 test cases (5 per shell) that
validate tab-completion end-to-end through real PTY sessions using the
`exhaustive` example binary with dynamic-env completions.

Shells covered: Bash, Fish, Zsh, Elvish.
Scenarios covered per shell: subcommand completion, long option
completion, option value completion, partial option value completion,
and subcommand-scoped option completion.
@epage
Copy link
Member

epage commented Feb 13, 2026

The PR description does not explain the goal of this extended coverage

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