Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(test): Suggest -- for libtest arguments #13448

Merged
merged 1 commit into from Feb 16, 2024
Merged

Conversation

epage
Copy link
Contributor

@epage epage commented Feb 16, 2024

We already do this so long as the argument doesn't look like a cargo test argument (e.g. --show-output)
but --ignored looks like --ignore-rust-version do the the suggestion algorithms prefix checks.

Before

error: unexpected argument '--ignored' found

  tip: a similar argument exists: '--ignore-rust-version'

Usage: cargo test --ignore-rust-version [TESTNAME] [-- [ARGS]...]

For more information, try '--help'.

After

error: unexpected argument '--ignored' found

  tip: a similar argument exists: '--ignore-rust-version'
  tip: to pass '--ignored' as a value, use '-- --ignored'

Usage: cargo test --ignore-rust-version [TESTNAME] [-- [ARGS]...]

For more information, try '--help'.

This was fixed in clap-rs/clap#5356 and we just need to update to take advantage of it.

Fixes #12494

We already do this so long as the argument doesn't look like a
`cargo test` argument (e.g. `--show-output`)
but `--ignored` looks like `--ignore-rust-version` do the the suggestion
algorithms prefix checks.

Before
```
error: unexpected argument '--ignored' found

  tip: a similar argument exists: '--ignore-rust-version'

Usage: cargo test --ignore-rust-version [TESTNAME] [-- [ARGS]...]

For more information, try '--help'.
```
After
```
error: unexpected argument '--ignored' found

  tip: a similar argument exists: '--ignore-rust-version'
  tip: to pass '--ignored' as a value, use '-- --ignored'

Usage: cargo test --ignore-rust-version [TESTNAME] [-- [ARGS]...]

For more information, try '--help'.
```

Fixes rust-lang#12494
@rustbot
Copy link
Collaborator

rustbot commented Feb 16, 2024

r? @weihanglo

rustbot has assigned @weihanglo.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 16, 2024
Copy link
Member

@weihanglo weihanglo left a comment

Choose a reason for hiding this comment

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

Although I don't quite think "pass as a value" is straightforward for people to understand, it does give an example to follow. Thanks for the fix!

@weihanglo
Copy link
Member

@bors r+

@bors
Copy link
Collaborator

bors commented Feb 16, 2024

📌 Commit 6f93fa7 has been approved by weihanglo

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 16, 2024
@bors
Copy link
Collaborator

bors commented Feb 16, 2024

⌛ Testing commit 6f93fa7 with merge 63581b3...

@bors
Copy link
Collaborator

bors commented Feb 16, 2024

☀️ Test successful - checks-actions
Approved by: weihanglo
Pushing 63581b3 to master...

1 similar comment
@bors
Copy link
Collaborator

bors commented Feb 16, 2024

☀️ Test successful - checks-actions
Approved by: weihanglo
Pushing 63581b3 to master...

@bors bors merged commit 63581b3 into rust-lang:master Feb 16, 2024
23 checks passed
@bors
Copy link
Collaborator

bors commented Feb 16, 2024

👀 Test was successful, but fast-forwarding failed: 422 Changes must be made through a pull request.

@epage epage deleted the test branch February 16, 2024 14:44
@epage
Copy link
Contributor Author

epage commented Feb 16, 2024

Agreed that its not the greatest but its also what we are already displaying in other cases. This just fixes an inconsistency about displaying it.

bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 17, 2024
Update cargo

11 commits in fc1d58fd0531a57a6b942a14cdcdbcb82ece16f3..9090349adc88e0fcae2644c2cceb830124a10d5d
2024-02-09 15:54:29 +0000 to 2024-02-16 16:56:57 +0000
- chore: Update snapbox (rust-lang/cargo#13441)
- chore(deps): update openssl to 3.2.1 again (rust-lang/cargo#13449)
- fix(test): Suggest `--` for libtest arguments (rust-lang/cargo#13448)
- chore(ci): Drop MSRV:1 patch field (rust-lang/cargo#13442)
- fix(add): Remove inconsistent period (rust-lang/cargo#13446)
- fix(add): Ensure users know a feature is being created (rust-lang/cargo#13434)
- Update tests for changes in latest nightly (rust-lang/cargo#13444)
- docs: Minor clarification of build script metadata. (rust-lang/cargo#13436)
- Fix old_cargos tests (rust-lang/cargo#13435)
- Fix confusing error messages for sparse index replaced source (rust-lang/cargo#13433)
- Enable edition migration for 2024 (rust-lang/cargo#13429)

r? ghost
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 17, 2024
Update cargo

11 commits in fc1d58fd0531a57a6b942a14cdcdbcb82ece16f3..9090349adc88e0fcae2644c2cceb830124a10d5d
2024-02-09 15:54:29 +0000 to 2024-02-16 16:56:57 +0000
- chore: Update snapbox (rust-lang/cargo#13441)
- chore(deps): update openssl to 3.2.1 again (rust-lang/cargo#13449)
- fix(test): Suggest `--` for libtest arguments (rust-lang/cargo#13448)
- chore(ci): Drop MSRV:1 patch field (rust-lang/cargo#13442)
- fix(add): Remove inconsistent period (rust-lang/cargo#13446)
- fix(add): Ensure users know a feature is being created (rust-lang/cargo#13434)
- Update tests for changes in latest nightly (rust-lang/cargo#13444)
- docs: Minor clarification of build script metadata. (rust-lang/cargo#13436)
- Fix old_cargos tests (rust-lang/cargo#13435)
- Fix confusing error messages for sparse index replaced source (rust-lang/cargo#13433)
- Enable edition migration for 2024 (rust-lang/cargo#13429)

r? ghost
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 18, 2024
Update cargo

12 commits in fc1d58fd0531a57a6b942a14cdcdbcb82ece16f3..7b7af3077bff8d60b7f124189bc9de227d3063a9
2024-02-09 15:54:29 +0000 to 2024-02-17 14:13:00 +0000
- Remove unnecessary `use` statement in metabuild (rust-lang/cargo#13455)
- chore: Update snapbox (rust-lang/cargo#13441)
- chore(deps): update openssl to 3.2.1 again (rust-lang/cargo#13449)
- fix(test): Suggest `--` for libtest arguments (rust-lang/cargo#13448)
- chore(ci): Drop MSRV:1 patch field (rust-lang/cargo#13442)
- fix(add): Remove inconsistent period (rust-lang/cargo#13446)
- fix(add): Ensure users know a feature is being created (rust-lang/cargo#13434)
- Update tests for changes in latest nightly (rust-lang/cargo#13444)
- docs: Minor clarification of build script metadata. (rust-lang/cargo#13436)
- Fix old_cargos tests (rust-lang/cargo#13435)
- Fix confusing error messages for sparse index replaced source (rust-lang/cargo#13433)
- Enable edition migration for 2024 (rust-lang/cargo#13429)
@rustbot rustbot added this to the 1.78.0 milestone Feb 18, 2024
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Feb 18, 2024
Update cargo

12 commits in fc1d58fd0531a57a6b942a14cdcdbcb82ece16f3..7b7af3077bff8d60b7f124189bc9de227d3063a9
2024-02-09 15:54:29 +0000 to 2024-02-17 14:13:00 +0000
- Remove unnecessary `use` statement in metabuild (rust-lang/cargo#13455)
- chore: Update snapbox (rust-lang/cargo#13441)
- chore(deps): update openssl to 3.2.1 again (rust-lang/cargo#13449)
- fix(test): Suggest `--` for libtest arguments (rust-lang/cargo#13448)
- chore(ci): Drop MSRV:1 patch field (rust-lang/cargo#13442)
- fix(add): Remove inconsistent period (rust-lang/cargo#13446)
- fix(add): Ensure users know a feature is being created (rust-lang/cargo#13434)
- Update tests for changes in latest nightly (rust-lang/cargo#13444)
- docs: Minor clarification of build script metadata. (rust-lang/cargo#13436)
- Fix old_cargos tests (rust-lang/cargo#13435)
- Fix confusing error messages for sparse index replaced source (rust-lang/cargo#13433)
- Enable edition migration for 2024 (rust-lang/cargo#13429)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make libtest flags more discoverable
4 participants