-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
test cleanup: Remove the argument from the project
function
#5746
Comments
Baited by the 99.9% I've started to take this on. (Turns out it's more like 80%..
😄) |
Heh true! I think in basically all cases though it can be |
Sure, though some tests are specifically testing for things like |
Yeah I had a look at the outliers and some deviate without a great reason, but there are a number of them that do have a good reason. Like workspace projects, or any kind of "foo" project and "bar" project. Anyways, after landing the change to remove the argument from the project function, I'll follow it up with a more curated change to make them use the default "foo". |
Remove the argument from the `project` test support function By rewriting the tests, with rerast (https://github.com/google/rerast), to use the newly introduced "at" method. First I added the following temporary function to cargotest::support: pub fn project_foo() -> ProjectBuilder { project("foo") } Then I defined the following rewrite.rs: use cargotest::support::{ project, project_foo }; fn rule1(a: &'static str) { replace!(project("foo") => project_foo()); replace!(project(a) => project_foo().at(a)); } Then I ran rerast: cargo +nightly rerast --rules_file=rewrite.rs --force --targets tests --file tests/testsuite/main.rs Finally I searched and replaced the references to project_foo with argument-less project (a little awkardly on macOS with a git clean). find tests -type f -exec sed -i -e 's/project_foo/project/g' {} + git clean -d tests Fixes #5746
Rework some test projects to use the "foo" default Generally that means either switching "foo" and "bar" around (reversing the arrow), or it means push "foo" to "bar" (and sometimes "bar" to "baz", etc..) to free up "foo". For trivia that leaves 80/1222 outliers, therefore 93.4% of test project use the default. :) Refs #5746
This argument can be "foo" 99.9% of the time, so let's remove it as an argument and simply hardcode it to
"foo"
!The text was updated successfully, but these errors were encountered: