-
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
Remove the argument from the project
test support function
#5752
Conversation
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
(rust_highfive has picked a reviewer for you, use r? to override) |
Good pick, highfive. |
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.
To help review I've pointed out the non-mechanical changes. 😄
pub fn project(name: &str) -> ProjectBuilder { | ||
ProjectBuilder::new(paths::root().join(name)) | ||
pub fn project() -> ProjectBuilder { | ||
ProjectBuilder::new(paths::root().join("foo")) |
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.
hard-coded "foo"
@@ -126,6 +126,11 @@ impl ProjectBuilder { | |||
} | |||
} | |||
|
|||
pub fn at<P: AsRef<Path>>(mut self, path: P) -> Self { | |||
self.root = Project::Rooted(paths::root().join(path)); | |||
self |
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.
newly introduced "at" method
.. in docs, commented code & tests targetting non-macos.
@bors: r+ Nice! |
📌 Commit 6da2ada has been approved by |
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
☀️ Test successful - status-appveyor, status-travis |
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:
Then I defined the following rewrite.rs:
Then I ran rerast:
Finally I searched and replaced the references to project_foo with
argument-less project (a little awkardly on macOS with a git clean).
Fixes #5746