Skip to content

Commit dad331c

Browse files
committed
Auto merge of #14269 - epage:test-ext, r=ehuss
fix(test)!: Clarify extension trait role with rename When browsing the docs, I feel like this will make it easier to tell the role of these traits within the API. Or in other words, I can easily tell that these fill a support role and for what, so I know when I care to look into them. We use this naming pattern for `cargo_test_support::paths::CargoPathExt`.
2 parents fb9d558 + a49921f commit dad331c

File tree

52 files changed

+66
-66
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+66
-66
lines changed

crates/cargo-test-support/src/lib.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,10 @@ pub mod tools;
7676
pub mod prelude {
7777
pub use crate::cargo_test;
7878
pub use crate::paths::CargoPathExt;
79-
pub use crate::ArgLine;
80-
pub use crate::CargoCommand;
81-
pub use crate::ChannelChanger;
82-
pub use crate::TestEnv;
79+
pub use crate::ArgLineCommandExt;
80+
pub use crate::CargoCommandExt;
81+
pub use crate::ChannelChangerCommandExt;
82+
pub use crate::TestEnvCommandExt;
8383
pub use snapbox::IntoData;
8484
}
8585

@@ -1248,27 +1248,27 @@ fn _process(t: &OsStr) -> ProcessBuilder {
12481248
}
12491249

12501250
/// Enable nightly features for testing
1251-
pub trait ChannelChanger {
1251+
pub trait ChannelChangerCommandExt {
12521252
/// The list of reasons should be why nightly cargo is needed. If it is
12531253
/// because of an unstable feature put the name of the feature as the reason,
12541254
/// e.g. `&["print-im-a-teapot"]`.
12551255
fn masquerade_as_nightly_cargo(self, _reasons: &[&str]) -> Self;
12561256
}
12571257

1258-
impl ChannelChanger for &mut ProcessBuilder {
1258+
impl ChannelChangerCommandExt for &mut ProcessBuilder {
12591259
fn masquerade_as_nightly_cargo(self, _reasons: &[&str]) -> Self {
12601260
self.env("__CARGO_TEST_CHANNEL_OVERRIDE_DO_NOT_USE_THIS", "nightly")
12611261
}
12621262
}
12631263

1264-
impl ChannelChanger for snapbox::cmd::Command {
1264+
impl ChannelChangerCommandExt for snapbox::cmd::Command {
12651265
fn masquerade_as_nightly_cargo(self, _reasons: &[&str]) -> Self {
12661266
self.env("__CARGO_TEST_CHANNEL_OVERRIDE_DO_NOT_USE_THIS", "nightly")
12671267
}
12681268
}
12691269

12701270
/// Establish a process's test environment
1271-
pub trait TestEnv: Sized {
1271+
pub trait TestEnvCommandExt: Sized {
12721272
fn test_env(mut self) -> Self {
12731273
// In general just clear out all cargo-specific configuration already in the
12741274
// environment. Our tests all assume a "default configuration" unless
@@ -1358,7 +1358,7 @@ pub trait TestEnv: Sized {
13581358
fn env_remove(self, key: &str) -> Self;
13591359
}
13601360

1361-
impl TestEnv for &mut ProcessBuilder {
1361+
impl TestEnvCommandExt for &mut ProcessBuilder {
13621362
fn current_dir<S: AsRef<std::path::Path>>(self, path: S) -> Self {
13631363
let path = path.as_ref();
13641364
self.cwd(path)
@@ -1371,7 +1371,7 @@ impl TestEnv for &mut ProcessBuilder {
13711371
}
13721372
}
13731373

1374-
impl TestEnv for snapbox::cmd::Command {
1374+
impl TestEnvCommandExt for snapbox::cmd::Command {
13751375
fn current_dir<S: AsRef<std::path::Path>>(self, path: S) -> Self {
13761376
self.current_dir(path)
13771377
}
@@ -1384,11 +1384,11 @@ impl TestEnv for snapbox::cmd::Command {
13841384
}
13851385

13861386
/// Test the cargo command
1387-
pub trait CargoCommand {
1387+
pub trait CargoCommandExt {
13881388
fn cargo_ui() -> Self;
13891389
}
13901390

1391-
impl CargoCommand for snapbox::cmd::Command {
1391+
impl CargoCommandExt for snapbox::cmd::Command {
13921392
fn cargo_ui() -> Self {
13931393
Self::new(cargo_exe())
13941394
.with_assert(compare::assert_ui())
@@ -1398,7 +1398,7 @@ impl CargoCommand for snapbox::cmd::Command {
13981398
}
13991399

14001400
/// Add a list of arguments as a line
1401-
pub trait ArgLine: Sized {
1401+
pub trait ArgLineCommandExt: Sized {
14021402
fn arg_line(mut self, s: &str) -> Self {
14031403
for mut arg in s.split_whitespace() {
14041404
if (arg.starts_with('"') && arg.ends_with('"'))
@@ -1416,13 +1416,13 @@ pub trait ArgLine: Sized {
14161416
fn arg<S: AsRef<std::ffi::OsStr>>(self, s: S) -> Self;
14171417
}
14181418

1419-
impl ArgLine for &mut ProcessBuilder {
1419+
impl ArgLineCommandExt for &mut ProcessBuilder {
14201420
fn arg<S: AsRef<std::ffi::OsStr>>(self, s: S) -> Self {
14211421
self.arg(s)
14221422
}
14231423
}
14241424

1425-
impl ArgLine for snapbox::cmd::Command {
1425+
impl ArgLineCommandExt for snapbox::cmd::Command {
14261426
fn arg<S: AsRef<std::ffi::OsStr>>(self, s: S) -> Self {
14271427
self.arg(s)
14281428
}

tests/testsuite/cargo_bench/no_keep_going/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use cargo_test_support::current_dir;
22
use cargo_test_support::file;
33
use cargo_test_support::prelude::*;
44
use cargo_test_support::str;
5-
use cargo_test_support::CargoCommand;
5+
use cargo_test_support::CargoCommandExt;
66
use cargo_test_support::Project;
77

88
#[cargo_test]

tests/testsuite/cargo_init/inherit_workspace_package_table/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use cargo_test_support::current_dir;
33
use cargo_test_support::file;
44
use cargo_test_support::prelude::*;
55
use cargo_test_support::str;
6-
use cargo_test_support::CargoCommand;
6+
use cargo_test_support::CargoCommandExt;
77
use cargo_test_support::Project;
88

99
#[cargo_test]

tests/testsuite/cargo_new/add_members_to_non_workspace/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use cargo_test_support::current_dir;
33
use cargo_test_support::file;
44
use cargo_test_support::prelude::*;
55
use cargo_test_support::str;
6-
use cargo_test_support::CargoCommand;
6+
use cargo_test_support::CargoCommandExt;
77
use cargo_test_support::Project;
88

99
#[cargo_test]

tests/testsuite/cargo_new/add_members_to_workspace_format_previous_items/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use cargo_test_support::current_dir;
33
use cargo_test_support::file;
44
use cargo_test_support::prelude::*;
55
use cargo_test_support::str;
6-
use cargo_test_support::CargoCommand;
6+
use cargo_test_support::CargoCommandExt;
77
use cargo_test_support::Project;
88

99
#[cargo_test]

tests/testsuite/cargo_new/add_members_to_workspace_format_sorted/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use cargo_test_support::current_dir;
33
use cargo_test_support::file;
44
use cargo_test_support::prelude::*;
55
use cargo_test_support::str;
6-
use cargo_test_support::CargoCommand;
6+
use cargo_test_support::CargoCommandExt;
77
use cargo_test_support::Project;
88

99
#[cargo_test]

tests/testsuite/cargo_new/add_members_to_workspace_with_absolute_package_path/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use cargo_test_support::current_dir;
33
use cargo_test_support::file;
44
use cargo_test_support::prelude::*;
55
use cargo_test_support::str;
6-
use cargo_test_support::CargoCommand;
6+
use cargo_test_support::CargoCommandExt;
77
use cargo_test_support::Project;
88

99
#[cargo_test]

tests/testsuite/cargo_new/add_members_to_workspace_with_empty_members/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use cargo_test_support::current_dir;
33
use cargo_test_support::file;
44
use cargo_test_support::prelude::*;
55
use cargo_test_support::str;
6-
use cargo_test_support::CargoCommand;
6+
use cargo_test_support::CargoCommandExt;
77
use cargo_test_support::Project;
88

99
#[cargo_test]

tests/testsuite/cargo_new/add_members_to_workspace_with_exclude_list/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use cargo_test_support::current_dir;
33
use cargo_test_support::file;
44
use cargo_test_support::prelude::*;
55
use cargo_test_support::str;
6-
use cargo_test_support::CargoCommand;
6+
use cargo_test_support::CargoCommandExt;
77
use cargo_test_support::Project;
88

99
#[cargo_test]

tests/testsuite/cargo_new/add_members_to_workspace_with_members_glob/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use cargo_test_support::current_dir;
33
use cargo_test_support::file;
44
use cargo_test_support::prelude::*;
55
use cargo_test_support::str;
6-
use cargo_test_support::CargoCommand;
6+
use cargo_test_support::CargoCommandExt;
77
use cargo_test_support::Project;
88

99
#[cargo_test]

0 commit comments

Comments
 (0)