Skip to content

Commit a39c2a3

Browse files
committed
Auto merge of #5987 - dwijnand:remove-cwd-root, r=alexcrichton
Remove/rework some redundant .cwd(p.root()) in tests Just a little trim to the tests.
2 parents 7afa449 + 3b786a0 commit a39c2a3

File tree

6 files changed

+7
-26
lines changed

6 files changed

+7
-26
lines changed

tests/testsuite/install.rs

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,7 @@ fn install_path() {
225225

226226
cargo_process("install --path").arg(p.root()).run();
227227
assert_has_installed_exe(cargo_home(), "foo");
228-
cargo_process("install --path .")
229-
.cwd(p.root())
228+
p.cargo("install --path .")
230229
.with_status(101)
231230
.with_stderr(
232231
"\
@@ -692,8 +691,7 @@ fn subcommand_works_out_of_the_box() {
692691
fn installs_from_cwd_by_default() {
693692
let p = project().file("src/main.rs", "fn main() {}").build();
694693

695-
cargo_process("install")
696-
.cwd(p.root())
694+
p.cargo("install")
697695
.with_stderr_contains(
698696
"warning: Using `cargo install` to install the binaries for the \
699697
project in current working directory is deprecated, \
@@ -725,8 +723,7 @@ fn installs_from_cwd_with_2018_warnings() {
725723
).file("src/main.rs", "fn main() {}")
726724
.build();
727725

728-
cargo_process("install")
729-
.cwd(p.root())
726+
p.cargo("install")
730727
.masquerade_as_nightly_cargo()
731728
.with_status(101)
732729
.with_stderr_contains(
@@ -1243,15 +1240,6 @@ fn install_ignores_cargo_config() {
12431240
pkg("bar", "0.0.1");
12441241

12451242
let p = project()
1246-
.file(
1247-
"Cargo.toml",
1248-
r#"
1249-
[package]
1250-
name = "foo"
1251-
version = "0.1.0"
1252-
authors = []
1253-
"#,
1254-
)
12551243
.file(
12561244
".cargo/config",
12571245
r#"
@@ -1262,6 +1250,6 @@ fn install_ignores_cargo_config() {
12621250
.file("src/main.rs", "fn main() {}")
12631251
.build();
12641252

1265-
cargo_process("install bar").cwd(p.root()).with_status(0).run();
1253+
p.cargo("install bar").run();
12661254
assert_has_installed_exe(cargo_home(), "bar");
12671255
}

tests/testsuite/metadata.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -903,7 +903,6 @@ fn cargo_metadata_no_deps_cwd() {
903903
.build();
904904

905905
p.cargo("metadata --no-deps")
906-
.cwd(p.root())
907906
.with_json(MANIFEST_OUTPUT)
908907
.run();
909908
}
@@ -916,7 +915,6 @@ fn cargo_metadata_bad_version() {
916915
.build();
917916

918917
p.cargo("metadata --no-deps --format-version 2")
919-
.cwd(p.root())
920918
.with_status(1)
921919
.with_stderr_contains(
922920
"\

tests/testsuite/package.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -490,8 +490,7 @@ fn package_git_submodule() {
490490
None,
491491
).unwrap();
492492

493-
cargo_process("package --no-verify -v")
494-
.cwd(project.root())
493+
project.cargo("package --no-verify -v")
495494
.with_stderr_contains("[ARCHIVING] bar/Makefile")
496495
.run();
497496
}
@@ -625,8 +624,7 @@ fn repackage_on_source_change() {
625624
std::mem::drop(file);
626625

627626
// Check that cargo rebuilds the tarball
628-
cargo_process("package")
629-
.cwd(p.root())
627+
p.cargo("package")
630628
.with_stderr(
631629
"\
632630
[WARNING] [..]

tests/testsuite/read_manifest.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ fn cargo_read_manifest_cwd() {
9898
.build();
9999

100100
p.cargo("read-manifest")
101-
.cwd(p.root())
102101
.with_json(MANIFEST_OUTPUT)
103102
.run();
104103
}

tests/testsuite/verify_project.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ fn cargo_verify_project_cwd() {
3939
.build();
4040

4141
p.cargo("verify-project")
42-
.cwd(p.root())
4342
.with_stdout(verify_project_success_output())
4443
.run();
4544
}

tests/testsuite/workspaces.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,7 @@ fn explicit_package_argument_works_with_virtual_manifest() {
699699
).file("bar/Cargo.toml", &basic_manifest("bar", "0.1.0"))
700700
.file("bar/src/main.rs", "fn main() {}");
701701
let p = p.build();
702-
p.cargo("build --package bar").cwd(p.root()).run();
702+
p.cargo("build --package bar").run();
703703
assert!(p.root().join("Cargo.lock").is_file());
704704
assert!(p.bin("bar").is_file());
705705
assert!(!p.root().join("bar/Cargo.lock").is_file());
@@ -1222,7 +1222,6 @@ fn relative_path_for_root_works() {
12221222
let p = p.build();
12231223

12241224
p.cargo("build --manifest-path ./Cargo.toml")
1225-
.cwd(p.root())
12261225
.run();
12271226

12281227
p.cargo("build --manifest-path ../Cargo.toml")

0 commit comments

Comments
 (0)