-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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): Distinguish 'testname' from escaped arguments #11190
Conversation
When working on clap v4, it appeared that `last` and `trailing_var_arg` are mutually exclusive, so I called that out in the debug asserts in clap-rs/clap#4187. Unfortunately, I didn't document my research on this as my focus was elsewhere. When updating cargo to use clap v4 in rust-lang#11159, I found `last` and `trailing_var_arg` were used together. I figured this was what I was trying to catch with above and I went off of my intuitive sense of these commands and assumed `trailing_var_arg` was intended, not knowing about the `testname` positional that is mostly just a forward to `libtest`, there for documentation purposes, except for a small optimization. So it looks like we just need the `last` call and not the `trailing_var_arg` call. This restores us to behavior from 531ce13 which is what I originally wrote the tests against.
r? @ehuss (rust-highfive has picked a reviewer for you, use r? to override) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for my oversight on this behaviour change.
Could you help double confirm that cargo run
, cargo rustc
, and cargo rustdoc
are not affected? From my understanding they should behave as before and just tested by hands them seem fine.
Feel free to |
Those commands are unrelated to the problem. This is a problem specifically with how I handled the change from
Responsibility first lies with the author, reviewers can't be expected to catch everything. Unless you knew to check this exact case, I bet we would have missed it anyways. r=weihanglo |
@bors r=weihanglo (of course I forgot to tag bors) |
I should have thought of that, since I did some fixes around it… Anyway, thanks for your quick patch! |
(hi I'm the one that found the behavior change) It's definitely good to restore previous behavior here, but it's also I think worth discussing whether To me, it seems quite odd that being explicit about which arguments are passed to the test runner should change how the test runner is run. Plus, in general, due to how rustdoc (ab)uses the test runner, flags can have distinctly different behavior. (The notable one I'm dealing with is |
#6981 is the issue for that. |
☀️ Test successful - checks-actions |
4 commits in 0b84a35c2c7d70df4875a03eb19084b0e7a543ef..3cdf1ab25dc4fe56f890e8c7330d53a23ad905d3 2022-10-03 19:13:21 +0000 to 2022-10-07 17:34:03 +0000 - fix(test): Distinguish 'testname' from escaped arguments (rust-lang/cargo#11190) - Fix sparse registry lockfile urls containing 'registry+sparse+' (rust-lang/cargo#11177) - doc(features2): polish docs a bit (rust-lang/cargo#11185) - Import `cargo remove` into cargo (rust-lang/cargo#11099)
Update cargo 4 commits in 0b84a35c2c7d70df4875a03eb19084b0e7a543ef..3cdf1ab25dc4fe56f890e8c7330d53a23ad905d3 2022-10-03 19:13:21 +0000 to 2022-10-07 17:34:03 +0000 - fix(test): Distinguish 'testname' from escaped arguments (rust-lang/cargo#11190) - Fix sparse registry lockfile urls containing 'registry+sparse+' (rust-lang/cargo#11177) - doc(features2): polish docs a bit (rust-lang/cargo#11185) - Import `cargo remove` into cargo (rust-lang/cargo#11099)
Update cargo 4 commits in 0b84a35c2c7d70df4875a03eb19084b0e7a543ef..3cdf1ab25dc4fe56f890e8c7330d53a23ad905d3 2022-10-03 19:13:21 +0000 to 2022-10-07 17:34:03 +0000 - fix(test): Distinguish 'testname' from escaped arguments (rust-lang/cargo#11190) - Fix sparse registry lockfile urls containing 'registry+sparse+' (rust-lang/cargo#11177) - doc(features2): polish docs a bit (rust-lang/cargo#11185) - Import `cargo remove` into cargo (rust-lang/cargo#11099)
When working on clap v4, it appeared that
last
andtrailing_var_arg
are mutually exclusive, so I called that out in the debug asserts in
#4187. Unfortunately, I didn't document my research on this
as my focus was elsewhere.
When updating cargo to use clap v4 in #11159, I found
last
andtrailing_var_arg
were used together. I figured this was what I wastrying to catch with above and I went off of my intuitive sense of these
commands and assumed
trailing_var_arg
was intended, not knowing aboutthe
testname
positional that is mostly just a forward tolibtest
,there for documentation purposes, except for a small optimization.
So it looks like we just need the
last
call and not thetrailing_var_arg
call.This restores us to behavior from 531ce13 which is what I originally
wrote the tests against.
It looks like #11159 was merged after the last beta branch was made, so we shouldn't
need to cherry-pick this into any other release.
For reviewing this, I made the test updates in the first commit, showing the wrong behavior. The following commit fixes the behavior and updates the tests to expected behavior.
Fixes #11191