From d028cfaba38eff457cdd2b6cb9688d6ea6f2a985 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Mon, 10 Jun 2024 10:20:41 -0500 Subject: [PATCH 01/10] chore(test): Bump cargo-test-support to 0.2.2 --- Cargo.lock | 2 +- crates/cargo-test-support/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3d4b211d74f..78e8928a900 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -413,7 +413,7 @@ version = "0.2.1" [[package]] name = "cargo-test-support" -version = "0.2.1" +version = "0.2.2" dependencies = [ "anstream", "anstyle", diff --git a/crates/cargo-test-support/Cargo.toml b/crates/cargo-test-support/Cargo.toml index 9d6ca7303ef..a8d5025f8de 100644 --- a/crates/cargo-test-support/Cargo.toml +++ b/crates/cargo-test-support/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cargo-test-support" -version = "0.2.1" +version = "0.2.2" edition.workspace = true rust-version = "1.78" # MSRV:1 license.workspace = true From ef26e8e0ffc93ff70979da0d15ef208c534b14bf Mon Sep 17 00:00:00 2001 From: Ed Page Date: Fri, 7 Jun 2024 14:24:03 -0500 Subject: [PATCH 02/10] feat(test): Make latest snapbox features available --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index ed173fc9a2e..be62418bf34 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -91,7 +91,7 @@ sha1 = "0.10.6" sha2 = "0.10.8" shell-escape = "0.1.5" supports-hyperlinks = "3.0.0" -snapbox = { version = "0.6.5", features = ["diff", "dir", "term-svg", "regex"] } +snapbox = { version = "0.6.9", features = ["diff", "dir", "term-svg", "regex"] } tar = { version = "0.4.40", default-features = false } tempfile = "3.10.1" thiserror = "1.0.59" From 2b7e335946258d9e9e333513ac6b288630f02700 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Fri, 7 Jun 2024 15:12:58 -0500 Subject: [PATCH 03/10] feat(test): Enable structured data assertions --- Cargo.lock | 1 + Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 78e8928a900..b4c44a27ee5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3230,6 +3230,7 @@ dependencies = [ "filetime", "normalize-line-endings", "regex", + "serde", "serde_json", "similar", "snapbox-macros", diff --git a/Cargo.toml b/Cargo.toml index be62418bf34..af9c3f4e8ce 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -91,7 +91,7 @@ sha1 = "0.10.6" sha2 = "0.10.8" shell-escape = "0.1.5" supports-hyperlinks = "3.0.0" -snapbox = { version = "0.6.9", features = ["diff", "dir", "term-svg", "regex"] } +snapbox = { version = "0.6.9", features = ["diff", "dir", "term-svg", "regex", "json"] } tar = { version = "0.4.40", default-features = false } tempfile = "3.10.1" thiserror = "1.0.59" From 15e3412b2f4df266bbbb5e8ad70a04112c04b2d6 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Fri, 7 Jun 2024 15:15:16 -0500 Subject: [PATCH 04/10] fix(test): Ensure panics show test code, not lib --- crates/cargo-test-support/src/lib.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crates/cargo-test-support/src/lib.rs b/crates/cargo-test-support/src/lib.rs index 5db67b8ea90..20f293ad742 100644 --- a/crates/cargo-test-support/src/lib.rs +++ b/crates/cargo-test-support/src/lib.rs @@ -908,6 +908,7 @@ impl Execs { } } + #[track_caller] fn verify_checks_output(&self, stdout: &[u8], stderr: &[u8]) { if self.expect_exit_code.unwrap_or(0) != 0 && self.expect_stdout.is_none() @@ -934,6 +935,7 @@ impl Execs { } } + #[track_caller] fn match_process(&self, process: &ProcessBuilder) -> Result { println!("running {}", process); let res = if self.stream_output { @@ -984,6 +986,7 @@ impl Execs { } } + #[track_caller] fn match_output(&self, code: Option, stdout: &[u8], stderr: &[u8]) -> Result<()> { self.verify_checks_output(stdout, stderr); let stdout = std::str::from_utf8(stdout).expect("stdout is not utf8"); From 8b7de1ea816d8da6bcc32e69425e131bfad61a9f Mon Sep 17 00:00:00 2001 From: Ed Page Date: Fri, 7 Jun 2024 15:45:02 -0500 Subject: [PATCH 05/10] feat(test): Auto-redact crate sizes from cargo-package --- crates/cargo-test-support/src/compare.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/crates/cargo-test-support/src/compare.rs b/crates/cargo-test-support/src/compare.rs index a6a9d30e7af..a12f92d9b5b 100644 --- a/crates/cargo-test-support/src/compare.rs +++ b/crates/cargo-test-support/src/compare.rs @@ -92,6 +92,11 @@ pub fn assert_ui() -> snapbox::Assert { regex::Regex::new("Finished.*in (?[0-9]+(\\.[0-9]+))s").unwrap(), ) .unwrap(); + subs.insert( + "[FILE_SIZE]", + regex::Regex::new("(?[0-9]+(\\.[0-9]+)([a-zA-Z]i)?)B").unwrap(), + ) + .unwrap(); snapbox::Assert::new() .action_env(snapbox::assert::DEFAULT_ACTION_ENV) .redact_with(subs) @@ -146,6 +151,11 @@ pub fn assert_e2e() -> snapbox::Assert { regex::Regex::new("[FINISHED].*in (?[0-9]+(\\.[0-9]+))s").unwrap(), ) .unwrap(); + subs.insert( + "[FILE_SIZE]", + regex::Regex::new("(?[0-9]+(\\.[0-9]+)([a-zA-Z]i)?)B").unwrap(), + ) + .unwrap(); snapbox::Assert::new() .action_env(snapbox::assert::DEFAULT_ACTION_ENV) .redact_with(subs) From 0761937bc74d48c551ee0e201e79b26b89fa873d Mon Sep 17 00:00:00 2001 From: Ed Page Date: Fri, 7 Jun 2024 15:50:28 -0500 Subject: [PATCH 06/10] feat(test): Auto-redact registry source hashes --- crates/cargo-test-support/src/compare.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/crates/cargo-test-support/src/compare.rs b/crates/cargo-test-support/src/compare.rs index a12f92d9b5b..af127eecad8 100644 --- a/crates/cargo-test-support/src/compare.rs +++ b/crates/cargo-test-support/src/compare.rs @@ -97,6 +97,11 @@ pub fn assert_ui() -> snapbox::Assert { regex::Regex::new("(?[0-9]+(\\.[0-9]+)([a-zA-Z]i)?)B").unwrap(), ) .unwrap(); + subs.insert( + "[HASH]", + regex::Regex::new("home/\\.cargo/registry/src/-(?[a-z0-9]+)").unwrap(), + ) + .unwrap(); snapbox::Assert::new() .action_env(snapbox::assert::DEFAULT_ACTION_ENV) .redact_with(subs) @@ -156,6 +161,11 @@ pub fn assert_e2e() -> snapbox::Assert { regex::Regex::new("(?[0-9]+(\\.[0-9]+)([a-zA-Z]i)?)B").unwrap(), ) .unwrap(); + subs.insert( + "[HASH]", + regex::Regex::new("home/\\.cargo/registry/src/-(?[a-z0-9]+)").unwrap(), + ) + .unwrap(); snapbox::Assert::new() .action_env(snapbox::assert::DEFAULT_ACTION_ENV) .redact_with(subs) From ff2ddebc718d479cfccac0ad461eb576f68e19de Mon Sep 17 00:00:00 2001 From: Ed Page Date: Fri, 7 Jun 2024 14:07:31 -0500 Subject: [PATCH 07/10] feat(test): Allow snapshotting of Execs --- crates/cargo-test-support/src/lib.rs | 43 ++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/crates/cargo-test-support/src/lib.rs b/crates/cargo-test-support/src/lib.rs index 20f293ad742..823f1ccceb9 100644 --- a/crates/cargo-test-support/src/lib.rs +++ b/crates/cargo-test-support/src/lib.rs @@ -25,6 +25,7 @@ use std::time::{self, Duration}; use anyhow::{bail, Result}; use cargo_util::{is_ci, ProcessBuilder, ProcessError}; +use snapbox::IntoData as _; use url::Url; use self::paths::CargoPathExt; @@ -534,6 +535,8 @@ pub struct Execs { expect_stdin: Option, expect_stderr: Option, expect_exit_code: Option, + expect_stdout_data: Option, + expect_stderr_data: Option, expect_stdout_contains: Vec, expect_stderr_contains: Vec, expect_stdout_contains_n: Vec<(String, usize)>, @@ -545,6 +548,7 @@ pub struct Execs { expect_json: Option, expect_json_contains_unordered: Option, stream_output: bool, + assert: snapbox::Assert, } impl Execs { @@ -567,6 +571,22 @@ impl Execs { self } + /// Verifies that stdout is equal to the given lines. + /// + /// See [`compare::assert_e2e`] for assertion details. + pub fn with_stdout_data(&mut self, expected: impl snapbox::IntoData) -> &mut Self { + self.expect_stdout_data = Some(expected.into_data()); + self + } + + /// Verifies that stderr is equal to the given lines. + /// + /// See [`compare::assert_e2e`] for assertion details. + pub fn with_stderr_data(&mut self, expected: impl snapbox::IntoData) -> &mut Self { + self.expect_stderr_data = Some(expected.into_data()); + self + } + /// Writes the given lines to stdin. pub fn with_stdin(&mut self, expected: S) -> &mut Self { self.expect_stdin = Some(expected.to_string()); @@ -914,6 +934,8 @@ impl Execs { && self.expect_stdout.is_none() && self.expect_stdin.is_none() && self.expect_stderr.is_none() + && self.expect_stdout_data.is_none() + && self.expect_stderr_data.is_none() && self.expect_stdout_contains.is_empty() && self.expect_stderr_contains.is_empty() && self.expect_stdout_contains_n.is_empty() @@ -1011,6 +1033,24 @@ impl Execs { if let Some(expect_stderr) = &self.expect_stderr { compare::match_exact(expect_stderr, stderr, "stderr", stdout, cwd)?; } + if let Some(expect_stdout_data) = &self.expect_stdout_data { + if let Err(err) = self.assert.try_eq( + Some(&"stdout"), + stdout.into_data(), + expect_stdout_data.clone(), + ) { + panic!("{err}") + } + } + if let Some(expect_stderr_data) = &self.expect_stderr_data { + if let Err(err) = self.assert.try_eq( + Some(&"stderr"), + stderr.into_data(), + expect_stderr_data.clone(), + ) { + panic!("{err}") + } + } for expect in self.expect_stdout_contains.iter() { compare::match_contains(expect, stdout, cwd)?; } @@ -1063,6 +1103,8 @@ pub fn execs() -> Execs { expect_stderr: None, expect_stdin: None, expect_exit_code: Some(0), + expect_stdout_data: None, + expect_stderr_data: None, expect_stdout_contains: Vec::new(), expect_stderr_contains: Vec::new(), expect_stdout_contains_n: Vec::new(), @@ -1074,6 +1116,7 @@ pub fn execs() -> Execs { expect_json: None, expect_json_contains_unordered: None, stream_output: false, + assert: compare::assert_e2e(), } } From dc5ac62cab3857688b7f6282ede478aca2c23686 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Fri, 7 Jun 2024 14:55:21 -0500 Subject: [PATCH 08/10] fix(test): Deprecate non-snapbox assertions While this is noisy and hides other deprecations, I figured deprecations would make it easier for people to discover what tasks remain and allow us to divide and conquer this work rather than doing a heroic PR. In theory, this will be short lived and we'll go back to seeing deprecations in our tests. --- crates/cargo-test-support/src/lib.rs | 12 ++++++++++++ tests/build-std/main.rs | 1 + tests/testsuite/advanced_env.rs | 2 ++ tests/testsuite/alt_registry.rs | 2 ++ tests/testsuite/artifact_dep.rs | 2 ++ tests/testsuite/artifact_dir.rs | 2 ++ tests/testsuite/bad_config.rs | 2 ++ tests/testsuite/bad_manifest_path.rs | 2 ++ tests/testsuite/bench.rs | 2 ++ tests/testsuite/binary_name.rs | 2 ++ tests/testsuite/build.rs | 2 ++ tests/testsuite/build_plan.rs | 2 ++ tests/testsuite/build_script.rs | 2 ++ tests/testsuite/build_script_env.rs | 2 ++ tests/testsuite/build_script_extra_link_arg.rs | 2 ++ tests/testsuite/cache_lock.rs | 2 ++ tests/testsuite/cache_messages.rs | 2 ++ tests/testsuite/cargo_alias_config.rs | 2 ++ tests/testsuite/cargo_command.rs | 2 ++ tests/testsuite/cargo_config/mod.rs | 2 ++ tests/testsuite/cargo_env_config.rs | 2 ++ tests/testsuite/cargo_features.rs | 2 ++ tests/testsuite/cargo_targets.rs | 2 ++ tests/testsuite/cfg.rs | 2 ++ tests/testsuite/check.rs | 2 ++ tests/testsuite/check_cfg.rs | 2 ++ tests/testsuite/clean.rs | 2 ++ tests/testsuite/collisions.rs | 2 ++ tests/testsuite/concurrent.rs | 2 ++ tests/testsuite/config.rs | 2 ++ tests/testsuite/config_cli.rs | 2 ++ tests/testsuite/config_include.rs | 2 ++ tests/testsuite/corrupt_git.rs | 2 ++ tests/testsuite/credential_process.rs | 2 ++ tests/testsuite/cross_compile.rs | 2 ++ tests/testsuite/cross_publish.rs | 2 ++ tests/testsuite/custom_target.rs | 2 ++ tests/testsuite/death.rs | 2 ++ tests/testsuite/dep_info.rs | 2 ++ tests/testsuite/diagnostics.rs | 2 ++ tests/testsuite/direct_minimal_versions.rs | 2 ++ tests/testsuite/directory.rs | 2 ++ tests/testsuite/doc.rs | 2 ++ tests/testsuite/docscrape.rs | 2 ++ tests/testsuite/edition.rs | 2 ++ tests/testsuite/error.rs | 2 ++ tests/testsuite/features.rs | 2 ++ tests/testsuite/features2.rs | 2 ++ tests/testsuite/features_namespaced.rs | 2 ++ tests/testsuite/fetch.rs | 2 ++ tests/testsuite/fix.rs | 2 ++ tests/testsuite/fix_n_times.rs | 2 ++ tests/testsuite/freshness.rs | 2 ++ tests/testsuite/future_incompat_report.rs | 2 ++ tests/testsuite/generate_lockfile.rs | 2 ++ tests/testsuite/git.rs | 2 ++ tests/testsuite/git_auth.rs | 2 ++ tests/testsuite/git_gc.rs | 2 ++ tests/testsuite/git_shallow.rs | 2 ++ tests/testsuite/glob_targets.rs | 2 ++ tests/testsuite/global_cache_tracker.rs | 2 ++ tests/testsuite/help.rs | 2 ++ tests/testsuite/https.rs | 2 ++ tests/testsuite/inheritable_workspace_fields.rs | 2 ++ tests/testsuite/install.rs | 2 ++ tests/testsuite/install_upgrade.rs | 2 ++ tests/testsuite/jobserver.rs | 2 ++ tests/testsuite/lints/implicit_features.rs | 2 ++ tests/testsuite/lints/mod.rs | 2 ++ tests/testsuite/lints/unknown_lints.rs | 2 ++ .../testsuite/lints/unused_optional_dependencies.rs | 2 ++ tests/testsuite/lints_table.rs | 2 ++ tests/testsuite/list_availables.rs | 2 ++ tests/testsuite/local_registry.rs | 2 ++ tests/testsuite/locate_project.rs | 2 ++ tests/testsuite/lockfile_compat.rs | 2 ++ tests/testsuite/login.rs | 2 ++ tests/testsuite/logout.rs | 2 ++ tests/testsuite/lto.rs | 2 ++ tests/testsuite/member_discovery.rs | 2 ++ tests/testsuite/member_errors.rs | 2 ++ tests/testsuite/message_format.rs | 2 ++ tests/testsuite/messages.rs | 2 ++ tests/testsuite/metabuild.rs | 2 ++ tests/testsuite/metadata.rs | 2 ++ tests/testsuite/minimal_versions.rs | 2 ++ tests/testsuite/multitarget.rs | 2 ++ tests/testsuite/net_config.rs | 2 ++ tests/testsuite/new.rs | 2 ++ tests/testsuite/offline.rs | 2 ++ tests/testsuite/old_cargos.rs | 2 ++ tests/testsuite/open_namespaces.rs | 2 ++ tests/testsuite/owner.rs | 2 ++ tests/testsuite/package.rs | 2 ++ tests/testsuite/package_features.rs | 2 ++ tests/testsuite/patch.rs | 2 ++ tests/testsuite/path.rs | 2 ++ tests/testsuite/paths.rs | 2 ++ tests/testsuite/pkgid.rs | 2 ++ tests/testsuite/precise_pre_release.rs | 2 ++ tests/testsuite/proc_macro.rs | 2 ++ tests/testsuite/profile_config.rs | 2 ++ tests/testsuite/profile_custom.rs | 2 ++ tests/testsuite/profile_overrides.rs | 2 ++ tests/testsuite/profile_targets.rs | 2 ++ tests/testsuite/profile_trim_paths.rs | 2 ++ tests/testsuite/profiles.rs | 2 ++ tests/testsuite/progress.rs | 2 ++ tests/testsuite/pub_priv.rs | 2 ++ tests/testsuite/publish.rs | 2 ++ tests/testsuite/publish_lockfile.rs | 2 ++ tests/testsuite/read_manifest.rs | 2 ++ tests/testsuite/registry.rs | 2 ++ tests/testsuite/registry_auth.rs | 2 ++ tests/testsuite/rename_deps.rs | 2 ++ tests/testsuite/replace.rs | 2 ++ tests/testsuite/required_features.rs | 2 ++ tests/testsuite/run.rs | 2 ++ tests/testsuite/rust_version.rs | 2 ++ tests/testsuite/rustc.rs | 2 ++ tests/testsuite/rustc_info_cache.rs | 2 ++ tests/testsuite/rustdoc.rs | 2 ++ tests/testsuite/rustdoc_extern_html.rs | 2 ++ tests/testsuite/rustdocflags.rs | 2 ++ tests/testsuite/rustflags.rs | 2 ++ tests/testsuite/rustup.rs | 2 ++ tests/testsuite/script.rs | 2 ++ tests/testsuite/search.rs | 2 ++ tests/testsuite/shell_quoting.rs | 2 ++ tests/testsuite/source_replacement.rs | 2 ++ tests/testsuite/ssh.rs | 2 ++ tests/testsuite/standard_lib.rs | 2 ++ tests/testsuite/test.rs | 2 ++ tests/testsuite/timings.rs | 2 ++ tests/testsuite/tool_paths.rs | 2 ++ tests/testsuite/tree.rs | 2 ++ tests/testsuite/tree_graph_features.rs | 2 ++ tests/testsuite/unit_graph.rs | 2 ++ tests/testsuite/update.rs | 2 ++ tests/testsuite/vendor.rs | 2 ++ tests/testsuite/verify_project.rs | 2 ++ tests/testsuite/version.rs | 2 ++ tests/testsuite/warn_on_failure.rs | 2 ++ tests/testsuite/weak_dep_features.rs | 2 ++ tests/testsuite/workspaces.rs | 2 ++ tests/testsuite/yank.rs | 2 ++ 146 files changed, 301 insertions(+) diff --git a/crates/cargo-test-support/src/lib.rs b/crates/cargo-test-support/src/lib.rs index 823f1ccceb9..751a0a7d9b5 100644 --- a/crates/cargo-test-support/src/lib.rs +++ b/crates/cargo-test-support/src/lib.rs @@ -559,6 +559,7 @@ impl Execs { /// Verifies that stdout is equal to the given lines. /// See [`compare`] for supported patterns. + #[deprecated(note = "replaced with `Execs::with_stdout_data(expected)`")] pub fn with_stdout(&mut self, expected: S) -> &mut Self { self.expect_stdout = Some(expected.to_string()); self @@ -566,6 +567,7 @@ impl Execs { /// Verifies that stderr is equal to the given lines. /// See [`compare`] for supported patterns. + #[deprecated(note = "replaced with `Execs::with_stderr_data(expected)`")] pub fn with_stderr(&mut self, expected: S) -> &mut Self { self.expect_stderr = Some(expected.to_string()); self @@ -613,6 +615,7 @@ impl Execs { /// its output. /// /// See [`compare`] for supported patterns. + #[deprecated(note = "replaced with `Execs::with_stdout_data(expected)`")] pub fn with_stdout_contains(&mut self, expected: S) -> &mut Self { self.expect_stdout_contains.push(expected.to_string()); self @@ -622,6 +625,7 @@ impl Execs { /// its output. /// /// See [`compare`] for supported patterns. + #[deprecated(note = "replaced with `Execs::with_stderr_data(expected)`")] pub fn with_stderr_contains(&mut self, expected: S) -> &mut Self { self.expect_stderr_contains.push(expected.to_string()); self @@ -631,6 +635,7 @@ impl Execs { /// its output, and should be repeated `number` times. /// /// See [`compare`] for supported patterns. + #[deprecated(note = "replaced with `Execs::with_stdout_data(expected)`")] pub fn with_stdout_contains_n(&mut self, expected: S, number: usize) -> &mut Self { self.expect_stdout_contains_n .push((expected.to_string(), number)); @@ -642,6 +647,7 @@ impl Execs { /// See [`compare`] for supported patterns. /// /// See note on [`Self::with_stderr_does_not_contain`]. + #[deprecated] pub fn with_stdout_does_not_contain(&mut self, expected: S) -> &mut Self { self.expect_stdout_not_contains.push(expected.to_string()); self @@ -656,6 +662,7 @@ impl Execs { /// your test will pass without verifying the correct behavior. If /// possible, write the test first so that it fails, and then implement /// your fix/feature to make it pass. + #[deprecated] pub fn with_stderr_does_not_contain(&mut self, expected: S) -> &mut Self { self.expect_stderr_not_contains.push(expected.to_string()); self @@ -665,6 +672,7 @@ impl Execs { /// ignoring the order of the lines. /// /// See [`Execs::with_stderr_unordered`] for more details. + #[deprecated(note = "replaced with `Execs::with_stdout_data(expected.unordered())`")] pub fn with_stdout_unordered(&mut self, expected: S) -> &mut Self { self.expect_stdout_unordered.push(expected.to_string()); self @@ -691,6 +699,7 @@ impl Execs { /// /// This will randomly fail if the other crate name is `bar`, and the /// order changes. + #[deprecated(note = "replaced with `Execs::with_stderr_data(expected.unordered())`")] pub fn with_stderr_unordered(&mut self, expected: S) -> &mut Self { self.expect_stderr_unordered.push(expected.to_string()); self @@ -718,6 +727,7 @@ impl Execs { /// /// Be careful writing the `without` fragments, see note in /// `with_stderr_does_not_contain`. + #[deprecated] pub fn with_stderr_line_without( &mut self, with: &[S], @@ -750,6 +760,7 @@ impl Execs { /// - The order of arrays is ignored. /// - Strings support patterns described in [`compare`]. /// - Use `"{...}"` to match any object. + #[deprecated(note = "replaced with `Execs::with_stdout_data(expected.json_lines())`")] pub fn with_json(&mut self, expected: &str) -> &mut Self { self.expect_json = Some(expected.to_string()); self @@ -764,6 +775,7 @@ impl Execs { /// what you are doing. /// /// See `with_json` for more detail. + #[deprecated] pub fn with_json_contains_unordered(&mut self, expected: &str) -> &mut Self { match &mut self.expect_json_contains_unordered { None => self.expect_json_contains_unordered = Some(expected.to_string()), diff --git a/tests/build-std/main.rs b/tests/build-std/main.rs index 84915790851..48e4ca60613 100644 --- a/tests/build-std/main.rs +++ b/tests/build-std/main.rs @@ -19,6 +19,7 @@ //! Otherwise the tests are skipped. #![allow(clippy::disallowed_methods)] +#![allow(deprecated)] use cargo_test_support::*; use std::env; diff --git a/tests/testsuite/advanced_env.rs b/tests/testsuite/advanced_env.rs index fb65839a205..d1a55229269 100644 --- a/tests/testsuite/advanced_env.rs +++ b/tests/testsuite/advanced_env.rs @@ -1,5 +1,7 @@ //! -Zadvanced-env tests +#![allow(deprecated)] + use cargo_test_support::{paths, project, registry::Package}; #[cargo_test] diff --git a/tests/testsuite/alt_registry.rs b/tests/testsuite/alt_registry.rs index 68466d0d005..f012e26932e 100644 --- a/tests/testsuite/alt_registry.rs +++ b/tests/testsuite/alt_registry.rs @@ -1,5 +1,7 @@ //! Tests for alternative registries. +#![allow(deprecated)] + use cargo_test_support::compare::assert_e2e; use cargo_test_support::publish::validate_alt_upload; use cargo_test_support::registry::{self, Package, RegistryBuilder}; diff --git a/tests/testsuite/artifact_dep.rs b/tests/testsuite/artifact_dep.rs index b8234140f7f..61cb85f4c7e 100644 --- a/tests/testsuite/artifact_dep.rs +++ b/tests/testsuite/artifact_dep.rs @@ -1,6 +1,8 @@ //! Tests specific to artifact dependencies, designated using //! the new `dep = { artifact = "bin", … }` syntax in manifests. +#![allow(deprecated)] + use cargo_test_support::compare::assert_e2e; use cargo_test_support::registry::{Package, RegistryBuilder}; use cargo_test_support::str; diff --git a/tests/testsuite/artifact_dir.rs b/tests/testsuite/artifact_dir.rs index ff83a720913..178bd13b118 100644 --- a/tests/testsuite/artifact_dir.rs +++ b/tests/testsuite/artifact_dir.rs @@ -1,5 +1,7 @@ //! Tests for --artifact-dir flag. +#![allow(deprecated)] + use cargo_test_support::sleep_ms; use cargo_test_support::{basic_manifest, project}; use std::env; diff --git a/tests/testsuite/bad_config.rs b/tests/testsuite/bad_config.rs index 15b718d4fae..be3ee217531 100644 --- a/tests/testsuite/bad_config.rs +++ b/tests/testsuite/bad_config.rs @@ -1,5 +1,7 @@ //! Tests for some invalid .cargo/config files. +#![allow(deprecated)] + use cargo_test_support::git::cargo_uses_gitoxide; use cargo_test_support::registry::{self, Package}; use cargo_test_support::{basic_manifest, project, rustc_host}; diff --git a/tests/testsuite/bad_manifest_path.rs b/tests/testsuite/bad_manifest_path.rs index fb214e32173..d6d09694df0 100644 --- a/tests/testsuite/bad_manifest_path.rs +++ b/tests/testsuite/bad_manifest_path.rs @@ -1,5 +1,7 @@ //! Tests for invalid --manifest-path arguments. +#![allow(deprecated)] + use cargo_test_support::{basic_bin_manifest, main_file, project}; #[track_caller] diff --git a/tests/testsuite/bench.rs b/tests/testsuite/bench.rs index 85efeaba568..1cb3f8c19a0 100644 --- a/tests/testsuite/bench.rs +++ b/tests/testsuite/bench.rs @@ -1,5 +1,7 @@ //! Tests for the `cargo bench` command. +#![allow(deprecated)] + use cargo_test_support::paths::CargoPathExt; use cargo_test_support::{basic_bin_manifest, basic_lib_manifest, basic_manifest, project}; diff --git a/tests/testsuite/binary_name.rs b/tests/testsuite/binary_name.rs index 7ef877c139c..d81fb460719 100644 --- a/tests/testsuite/binary_name.rs +++ b/tests/testsuite/binary_name.rs @@ -1,3 +1,5 @@ +#![allow(deprecated)] + use cargo_test_support::install::{ assert_has_installed_exe, assert_has_not_installed_exe, cargo_home, }; diff --git a/tests/testsuite/build.rs b/tests/testsuite/build.rs index 6fb2d416c75..3352ee3fed8 100644 --- a/tests/testsuite/build.rs +++ b/tests/testsuite/build.rs @@ -1,5 +1,7 @@ //! Tests for the `cargo build` command. +#![allow(deprecated)] + use cargo::{ core::compiler::CompileMode, core::{Shell, Workspace}, diff --git a/tests/testsuite/build_plan.rs b/tests/testsuite/build_plan.rs index 647bc123463..efbc4bd96aa 100644 --- a/tests/testsuite/build_plan.rs +++ b/tests/testsuite/build_plan.rs @@ -1,5 +1,7 @@ //! Tests for --build-plan feature. +#![allow(deprecated)] + use cargo_test_support::registry::Package; use cargo_test_support::{basic_bin_manifest, basic_manifest, main_file, project}; diff --git a/tests/testsuite/build_script.rs b/tests/testsuite/build_script.rs index 0b922f98c08..274955aeefd 100644 --- a/tests/testsuite/build_script.rs +++ b/tests/testsuite/build_script.rs @@ -1,5 +1,7 @@ //! Tests for build.rs scripts. +#![allow(deprecated)] + use cargo_test_support::compare::assert_e2e; use cargo_test_support::install::cargo_home; use cargo_test_support::paths::CargoPathExt; diff --git a/tests/testsuite/build_script_env.rs b/tests/testsuite/build_script_env.rs index 94c096124e9..c22082137d2 100644 --- a/tests/testsuite/build_script_env.rs +++ b/tests/testsuite/build_script_env.rs @@ -1,5 +1,7 @@ //! Tests for build.rs rerun-if-env-changed and rustc-env +#![allow(deprecated)] + use cargo_test_support::basic_manifest; use cargo_test_support::project; use cargo_test_support::sleep_ms; diff --git a/tests/testsuite/build_script_extra_link_arg.rs b/tests/testsuite/build_script_extra_link_arg.rs index 6414dd5e7e8..25132ef4db8 100644 --- a/tests/testsuite/build_script_extra_link_arg.rs +++ b/tests/testsuite/build_script_extra_link_arg.rs @@ -4,6 +4,8 @@ // because MSVC link.exe just gives a warning on unknown flags (how helpful!), // and other linkers will return an error. +#![allow(deprecated)] + use cargo_test_support::registry::Package; use cargo_test_support::{basic_bin_manifest, basic_lib_manifest, basic_manifest, project}; diff --git a/tests/testsuite/cache_lock.rs b/tests/testsuite/cache_lock.rs index 8304eaebe72..c6ed0874cb5 100644 --- a/tests/testsuite/cache_lock.rs +++ b/tests/testsuite/cache_lock.rs @@ -1,5 +1,7 @@ //! Tests for `CacheLock`. +#![allow(deprecated)] + use crate::config::GlobalContextBuilder; use cargo::util::cache_lock::{CacheLockMode, CacheLocker}; use cargo_test_support::paths::{self, CargoPathExt}; diff --git a/tests/testsuite/cache_messages.rs b/tests/testsuite/cache_messages.rs index 81933f93f72..51ca2a30def 100644 --- a/tests/testsuite/cache_messages.rs +++ b/tests/testsuite/cache_messages.rs @@ -1,5 +1,7 @@ //! Tests for caching compiler diagnostics. +#![allow(deprecated)] + use super::messages::raw_rustc_output; use cargo_test_support::tools; use cargo_test_support::{basic_manifest, is_coarse_mtime, project, registry::Package, sleep_ms}; diff --git a/tests/testsuite/cargo_alias_config.rs b/tests/testsuite/cargo_alias_config.rs index 4ea188a8810..eb4dea9f1ba 100644 --- a/tests/testsuite/cargo_alias_config.rs +++ b/tests/testsuite/cargo_alias_config.rs @@ -1,5 +1,7 @@ //! Tests for `[alias]` config command aliases. +#![allow(deprecated)] + use std::env; use cargo_test_support::tools::echo_subcommand; diff --git a/tests/testsuite/cargo_command.rs b/tests/testsuite/cargo_command.rs index 80885805bde..446128ae77e 100644 --- a/tests/testsuite/cargo_command.rs +++ b/tests/testsuite/cargo_command.rs @@ -1,5 +1,7 @@ //! Tests for custom cargo commands and other global command features. +#![allow(deprecated)] + use std::env; use std::fs; use std::io::Read; diff --git a/tests/testsuite/cargo_config/mod.rs b/tests/testsuite/cargo_config/mod.rs index e4ce992c36c..039d11f91ca 100644 --- a/tests/testsuite/cargo_config/mod.rs +++ b/tests/testsuite/cargo_config/mod.rs @@ -1,5 +1,7 @@ //! Tests for the `cargo config` command. +#![allow(deprecated)] + use super::config::write_config_at; use cargo_test_support::paths; use std::fs; diff --git a/tests/testsuite/cargo_env_config.rs b/tests/testsuite/cargo_env_config.rs index 33d826f3f11..80b167f288c 100644 --- a/tests/testsuite/cargo_env_config.rs +++ b/tests/testsuite/cargo_env_config.rs @@ -1,5 +1,7 @@ //! Tests for `[env]` config. +#![allow(deprecated)] + use cargo_test_support::basic_manifest; use cargo_test_support::{basic_bin_manifest, project}; diff --git a/tests/testsuite/cargo_features.rs b/tests/testsuite/cargo_features.rs index cf3956e60ed..bcf5222a456 100644 --- a/tests/testsuite/cargo_features.rs +++ b/tests/testsuite/cargo_features.rs @@ -1,5 +1,7 @@ //! Tests for `cargo-features` definitions. +#![allow(deprecated)] + use cargo_test_support::registry::Package; use cargo_test_support::{project, registry}; diff --git a/tests/testsuite/cargo_targets.rs b/tests/testsuite/cargo_targets.rs index b22acfeb929..23ba21e7726 100644 --- a/tests/testsuite/cargo_targets.rs +++ b/tests/testsuite/cargo_targets.rs @@ -1,5 +1,7 @@ //! Tests specifically related to target handling (lib, bins, examples, tests, benches). +#![allow(deprecated)] + use cargo_test_support::project; #[cargo_test] diff --git a/tests/testsuite/cfg.rs b/tests/testsuite/cfg.rs index 069dd64088e..09f06c4be58 100644 --- a/tests/testsuite/cfg.rs +++ b/tests/testsuite/cfg.rs @@ -1,5 +1,7 @@ //! Tests for cfg() expressions. +#![allow(deprecated)] + use cargo_test_support::registry::Package; use cargo_test_support::rustc_host; use cargo_test_support::{basic_manifest, project}; diff --git a/tests/testsuite/check.rs b/tests/testsuite/check.rs index 6ad7d81f5b9..5993e727b81 100644 --- a/tests/testsuite/check.rs +++ b/tests/testsuite/check.rs @@ -1,5 +1,7 @@ //! Tests for the `cargo check` command. +#![allow(deprecated)] + use std::fmt::{self, Write}; use crate::messages::raw_rustc_output; diff --git a/tests/testsuite/check_cfg.rs b/tests/testsuite/check_cfg.rs index d01a731bf25..4274bdfe1ee 100644 --- a/tests/testsuite/check_cfg.rs +++ b/tests/testsuite/check_cfg.rs @@ -1,5 +1,7 @@ //! Tests for Cargo usage of rustc `--check-cfg`. +#![allow(deprecated)] + use cargo_test_support::{basic_manifest, project}; macro_rules! x { diff --git a/tests/testsuite/clean.rs b/tests/testsuite/clean.rs index aae84c0c959..f6db2119a91 100644 --- a/tests/testsuite/clean.rs +++ b/tests/testsuite/clean.rs @@ -1,5 +1,7 @@ //! Tests for the `cargo clean` command. +#![allow(deprecated)] + use cargo_test_support::paths::CargoPathExt; use cargo_test_support::registry::Package; use cargo_test_support::{ diff --git a/tests/testsuite/collisions.rs b/tests/testsuite/collisions.rs index 0f1cdf20051..7fa721c7f67 100644 --- a/tests/testsuite/collisions.rs +++ b/tests/testsuite/collisions.rs @@ -3,6 +3,8 @@ //! Ideally these should never happen, but I don't think we'll ever be able to //! prevent all collisions. +#![allow(deprecated)] + use cargo_test_support::registry::Package; use cargo_test_support::{basic_manifest, cross_compile, project}; use std::env; diff --git a/tests/testsuite/concurrent.rs b/tests/testsuite/concurrent.rs index 1a1ae38fae7..828be7feda8 100644 --- a/tests/testsuite/concurrent.rs +++ b/tests/testsuite/concurrent.rs @@ -1,5 +1,7 @@ //! Tests for running multiple `cargo` processes at the same time. +#![allow(deprecated)] + use std::fs; use std::net::TcpListener; use std::process::Stdio; diff --git a/tests/testsuite/config.rs b/tests/testsuite/config.rs index 7d9bf74d644..a0b88e602c3 100644 --- a/tests/testsuite/config.rs +++ b/tests/testsuite/config.rs @@ -1,5 +1,7 @@ //! Tests for config settings. +#![allow(deprecated)] + use cargo::core::features::{GitFeatures, GitoxideFeatures}; use cargo::core::{PackageIdSpec, Shell}; use cargo::util::context::{ diff --git a/tests/testsuite/config_cli.rs b/tests/testsuite/config_cli.rs index cf6a52fedf4..f7da068106e 100644 --- a/tests/testsuite/config_cli.rs +++ b/tests/testsuite/config_cli.rs @@ -1,5 +1,7 @@ //! Tests for the --config CLI option. +#![allow(deprecated)] + use super::config::{ assert_error, read_output, write_config_at, write_config_toml, GlobalContextBuilder, }; diff --git a/tests/testsuite/config_include.rs b/tests/testsuite/config_include.rs index cc133ae587b..a2230d5ad41 100644 --- a/tests/testsuite/config_include.rs +++ b/tests/testsuite/config_include.rs @@ -1,5 +1,7 @@ //! Tests for `include` config field. +#![allow(deprecated)] + use super::config::{assert_error, write_config_at, write_config_toml, GlobalContextBuilder}; use cargo_test_support::{no_such_file_err_msg, project}; diff --git a/tests/testsuite/corrupt_git.rs b/tests/testsuite/corrupt_git.rs index 2569e460b27..22d2504ed2f 100644 --- a/tests/testsuite/corrupt_git.rs +++ b/tests/testsuite/corrupt_git.rs @@ -1,5 +1,7 @@ //! Tests for corrupt git repos. +#![allow(deprecated)] + use cargo_test_support::paths; use cargo_test_support::{basic_manifest, git, project}; use cargo_util::paths as cargopaths; diff --git a/tests/testsuite/credential_process.rs b/tests/testsuite/credential_process.rs index b097d9da0ae..a09fa073e81 100644 --- a/tests/testsuite/credential_process.rs +++ b/tests/testsuite/credential_process.rs @@ -1,5 +1,7 @@ //! Tests for credential-process. +#![allow(deprecated)] + use cargo_test_support::registry::{Package, TestRegistry}; use cargo_test_support::{basic_manifest, cargo_process, paths, project, registry, Project}; diff --git a/tests/testsuite/cross_compile.rs b/tests/testsuite/cross_compile.rs index 85cc7174ced..765cd6da2cc 100644 --- a/tests/testsuite/cross_compile.rs +++ b/tests/testsuite/cross_compile.rs @@ -2,6 +2,8 @@ //! //! See `cargo_test_support::cross_compile` for more detail. +#![allow(deprecated)] + use cargo_test_support::rustc_host; use cargo_test_support::{basic_bin_manifest, basic_manifest, cross_compile, project}; diff --git a/tests/testsuite/cross_publish.rs b/tests/testsuite/cross_publish.rs index 676c71b54f4..7537345e4af 100644 --- a/tests/testsuite/cross_publish.rs +++ b/tests/testsuite/cross_publish.rs @@ -1,5 +1,7 @@ //! Tests for publishing using the `--target` flag. +#![allow(deprecated)] + use std::fs::File; use cargo_test_support::{cross_compile, project, publish, registry}; diff --git a/tests/testsuite/custom_target.rs b/tests/testsuite/custom_target.rs index 191d4cd517a..3bfd7cd8e91 100644 --- a/tests/testsuite/custom_target.rs +++ b/tests/testsuite/custom_target.rs @@ -1,5 +1,7 @@ //! Tests for custom json target specifications. +#![allow(deprecated)] + use cargo_test_support::{basic_manifest, project}; use std::fs; diff --git a/tests/testsuite/death.rs b/tests/testsuite/death.rs index f9049a8f168..93884cb1236 100644 --- a/tests/testsuite/death.rs +++ b/tests/testsuite/death.rs @@ -1,5 +1,7 @@ //! Tests for ctrl-C handling. +#![allow(deprecated)] + use cargo_test_support::{project, slow_cpu_multiplier}; use std::fs; use std::io::{self, Read}; diff --git a/tests/testsuite/dep_info.rs b/tests/testsuite/dep_info.rs index 4aada7da7af..71d157f1f16 100644 --- a/tests/testsuite/dep_info.rs +++ b/tests/testsuite/dep_info.rs @@ -1,6 +1,8 @@ //! Tests for dep-info files. This includes the dep-info file Cargo creates in //! the output directory, and the ones stored in the fingerprint. +#![allow(deprecated)] + use cargo_test_support::compare::assert_e2e; use cargo_test_support::paths::{self, CargoPathExt}; use cargo_test_support::registry::Package; diff --git a/tests/testsuite/diagnostics.rs b/tests/testsuite/diagnostics.rs index 98a9f421cbb..68b95fc2fea 100644 --- a/tests/testsuite/diagnostics.rs +++ b/tests/testsuite/diagnostics.rs @@ -1,3 +1,5 @@ +#![allow(deprecated)] + use cargo_test_support::project; #[cargo_test] diff --git a/tests/testsuite/direct_minimal_versions.rs b/tests/testsuite/direct_minimal_versions.rs index f7ee2607c36..b3c2136c8b4 100644 --- a/tests/testsuite/direct_minimal_versions.rs +++ b/tests/testsuite/direct_minimal_versions.rs @@ -2,6 +2,8 @@ //! //! Note: Some tests are located in the resolver-tests package. +#![allow(deprecated)] + use cargo_test_support::project; use cargo_test_support::registry::Package; diff --git a/tests/testsuite/directory.rs b/tests/testsuite/directory.rs index 3af475a358a..fc84cede3b8 100644 --- a/tests/testsuite/directory.rs +++ b/tests/testsuite/directory.rs @@ -1,5 +1,7 @@ //! Tests for directory sources. +#![allow(deprecated)] + use std::collections::HashMap; use std::fs; use std::str; diff --git a/tests/testsuite/doc.rs b/tests/testsuite/doc.rs index 21189d363be..588e3dd1128 100644 --- a/tests/testsuite/doc.rs +++ b/tests/testsuite/doc.rs @@ -1,5 +1,7 @@ //! Tests for the `cargo doc` command. +#![allow(deprecated)] + use cargo::core::compiler::RustDocFingerprint; use cargo_test_support::paths::CargoPathExt; use cargo_test_support::registry::Package; diff --git a/tests/testsuite/docscrape.rs b/tests/testsuite/docscrape.rs index d799490585d..641ba6db655 100644 --- a/tests/testsuite/docscrape.rs +++ b/tests/testsuite/docscrape.rs @@ -1,5 +1,7 @@ //! Tests for the `cargo doc` command with `-Zrustdoc-scrape-examples`. +#![allow(deprecated)] + use cargo_test_support::project; #[cargo_test(nightly, reason = "rustdoc scrape examples flags are unstable")] diff --git a/tests/testsuite/edition.rs b/tests/testsuite/edition.rs index 14b5e8460d1..e6d492232b5 100644 --- a/tests/testsuite/edition.rs +++ b/tests/testsuite/edition.rs @@ -1,5 +1,7 @@ //! Tests for edition setting. +#![allow(deprecated)] + use cargo::core::Edition; use cargo_test_support::{basic_lib_manifest, project}; diff --git a/tests/testsuite/error.rs b/tests/testsuite/error.rs index 410902c2151..16108c62fbf 100644 --- a/tests/testsuite/error.rs +++ b/tests/testsuite/error.rs @@ -1,5 +1,7 @@ //! General error tests that don't belong anywhere else. +#![allow(deprecated)] + use cargo_test_support::cargo_process; #[cargo_test] diff --git a/tests/testsuite/features.rs b/tests/testsuite/features.rs index 0b83f31af2e..7f97e123173 100644 --- a/tests/testsuite/features.rs +++ b/tests/testsuite/features.rs @@ -1,5 +1,7 @@ //! Tests for `[features]` table. +#![allow(deprecated)] + use cargo_test_support::paths::CargoPathExt; use cargo_test_support::registry::{Dependency, Package}; use cargo_test_support::{basic_manifest, project}; diff --git a/tests/testsuite/features2.rs b/tests/testsuite/features2.rs index 9d696978f91..1a2f5d7a7ca 100644 --- a/tests/testsuite/features2.rs +++ b/tests/testsuite/features2.rs @@ -1,5 +1,7 @@ //! Tests for the new feature resolver. +#![allow(deprecated)] + use cargo_test_support::cross_compile::{self, alternate}; use cargo_test_support::install::cargo_home; use cargo_test_support::paths::CargoPathExt; diff --git a/tests/testsuite/features_namespaced.rs b/tests/testsuite/features_namespaced.rs index a68ef593236..acc1078452d 100644 --- a/tests/testsuite/features_namespaced.rs +++ b/tests/testsuite/features_namespaced.rs @@ -1,5 +1,7 @@ //! Tests for namespaced features. +#![allow(deprecated)] + use super::features2::switch_to_resolver_2; use cargo_test_support::registry::{Dependency, Package, RegistryBuilder}; use cargo_test_support::{project, publish}; diff --git a/tests/testsuite/fetch.rs b/tests/testsuite/fetch.rs index 14975c81e0b..d90004a220a 100644 --- a/tests/testsuite/fetch.rs +++ b/tests/testsuite/fetch.rs @@ -1,5 +1,7 @@ //! Tests for the `cargo fetch` command. +#![allow(deprecated)] + use cargo_test_support::registry::Package; use cargo_test_support::rustc_host; use cargo_test_support::{basic_manifest, cross_compile, project}; diff --git a/tests/testsuite/fix.rs b/tests/testsuite/fix.rs index 58c897df5d4..1a34996449b 100644 --- a/tests/testsuite/fix.rs +++ b/tests/testsuite/fix.rs @@ -1,5 +1,7 @@ //! Tests for the `cargo fix` command. +#![allow(deprecated)] + use cargo::core::Edition; use cargo_test_support::compare::assert_e2e; use cargo_test_support::git::{self, init}; diff --git a/tests/testsuite/fix_n_times.rs b/tests/testsuite/fix_n_times.rs index e74fd595dc4..915d741cf32 100644 --- a/tests/testsuite/fix_n_times.rs +++ b/tests/testsuite/fix_n_times.rs @@ -14,6 +14,8 @@ //! The [`expect_fix_runs_rustc_n_times`] function handles setting everything //! up, and verifying the results. +#![allow(deprecated)] + use cargo_test_support::{basic_manifest, paths, project, tools, Execs}; use std::path::PathBuf; use std::sync::{Mutex, OnceLock}; diff --git a/tests/testsuite/freshness.rs b/tests/testsuite/freshness.rs index faeea396dc9..cc9b516391d 100644 --- a/tests/testsuite/freshness.rs +++ b/tests/testsuite/freshness.rs @@ -1,5 +1,7 @@ //! Tests for fingerprinting (rebuild detection). +#![allow(deprecated)] + use filetime::FileTime; use std::fs::{self, OpenOptions}; use std::io; diff --git a/tests/testsuite/future_incompat_report.rs b/tests/testsuite/future_incompat_report.rs index 131b5829eff..336e13c7650 100644 --- a/tests/testsuite/future_incompat_report.rs +++ b/tests/testsuite/future_incompat_report.rs @@ -7,6 +7,8 @@ //! So we pick some random lint that will likely always be the same //! over time. +#![allow(deprecated)] + use super::config::write_config_toml; use cargo_test_support::registry::Package; use cargo_test_support::{basic_manifest, project, Project}; diff --git a/tests/testsuite/generate_lockfile.rs b/tests/testsuite/generate_lockfile.rs index db706a1754b..5c056963f41 100644 --- a/tests/testsuite/generate_lockfile.rs +++ b/tests/testsuite/generate_lockfile.rs @@ -1,5 +1,7 @@ //! Tests for the `cargo generate-lockfile` command. +#![allow(deprecated)] + use cargo_test_support::registry::{Package, RegistryBuilder}; use cargo_test_support::{basic_manifest, paths, project, ProjectBuilder}; use std::fs; diff --git a/tests/testsuite/git.rs b/tests/testsuite/git.rs index 1115b0a8f6d..6b9cbd308c6 100644 --- a/tests/testsuite/git.rs +++ b/tests/testsuite/git.rs @@ -1,5 +1,7 @@ //! Tests for git support. +#![allow(deprecated)] + use std::fs; use std::io::prelude::*; use std::net::{TcpListener, TcpStream}; diff --git a/tests/testsuite/git_auth.rs b/tests/testsuite/git_auth.rs index d11fa75be41..291531f8a11 100644 --- a/tests/testsuite/git_auth.rs +++ b/tests/testsuite/git_auth.rs @@ -1,5 +1,7 @@ //! Tests for git authentication. +#![allow(deprecated)] + use std::collections::HashSet; use std::io::prelude::*; use std::io::BufReader; diff --git a/tests/testsuite/git_gc.rs b/tests/testsuite/git_gc.rs index fd4fe30a979..a54cf68ef1d 100644 --- a/tests/testsuite/git_gc.rs +++ b/tests/testsuite/git_gc.rs @@ -1,5 +1,7 @@ //! Tests for git garbage collection. +#![allow(deprecated)] + use std::env; use std::ffi::OsStr; use std::path::PathBuf; diff --git a/tests/testsuite/git_shallow.rs b/tests/testsuite/git_shallow.rs index ca27ccd644e..4191a7ef74b 100644 --- a/tests/testsuite/git_shallow.rs +++ b/tests/testsuite/git_shallow.rs @@ -1,3 +1,5 @@ +#![allow(deprecated)] + use crate::git_gc::find_index; use cargo_test_support::registry::Package; use cargo_test_support::{basic_manifest, git, paths, project}; diff --git a/tests/testsuite/glob_targets.rs b/tests/testsuite/glob_targets.rs index f26cc90dc2d..626d1a967a5 100644 --- a/tests/testsuite/glob_targets.rs +++ b/tests/testsuite/glob_targets.rs @@ -1,5 +1,7 @@ //! Tests for target filter flags with glob patterns. +#![allow(deprecated)] + use cargo_test_support::{project, Project}; #[cargo_test] diff --git a/tests/testsuite/global_cache_tracker.rs b/tests/testsuite/global_cache_tracker.rs index 7dfb31997be..64abca8b73f 100644 --- a/tests/testsuite/global_cache_tracker.rs +++ b/tests/testsuite/global_cache_tracker.rs @@ -6,6 +6,8 @@ //! what happens when time passes. The [`days_ago_unix`] and //! [`months_ago_unix`] functions help with setting this value. +#![allow(deprecated)] + use super::config::GlobalContextBuilder; use cargo::core::global_cache_tracker::{self, DeferredGlobalLastUse, GlobalCacheTracker}; use cargo::util::cache_lock::CacheLockMode; diff --git a/tests/testsuite/help.rs b/tests/testsuite/help.rs index 12b6f7af8e1..5edb0879805 100644 --- a/tests/testsuite/help.rs +++ b/tests/testsuite/help.rs @@ -1,5 +1,7 @@ //! Tests for cargo's help output. +#![allow(deprecated)] + use cargo_test_support::registry::Package; use cargo_test_support::{basic_manifest, cargo_exe, cargo_process, paths, process, project}; use std::fs; diff --git a/tests/testsuite/https.rs b/tests/testsuite/https.rs index 8940722322c..d08c8d7ce00 100644 --- a/tests/testsuite/https.rs +++ b/tests/testsuite/https.rs @@ -3,6 +3,8 @@ //! Note that these tests will generally require setting CARGO_CONTAINER_TESTS //! or CARGO_PUBLIC_NETWORK_TESTS. +#![allow(deprecated)] + use cargo_test_support::containers::Container; use cargo_test_support::project; diff --git a/tests/testsuite/inheritable_workspace_fields.rs b/tests/testsuite/inheritable_workspace_fields.rs index 9b6c3fbcf8e..51ca8309c48 100644 --- a/tests/testsuite/inheritable_workspace_fields.rs +++ b/tests/testsuite/inheritable_workspace_fields.rs @@ -1,4 +1,6 @@ //! Tests for inheriting Cargo.toml fields with field.workspace = true +#![allow(deprecated)] + use cargo_test_support::registry::{Dependency, Package, RegistryBuilder}; use cargo_test_support::{ basic_lib_manifest, basic_manifest, git, path2url, paths, project, publish, registry, diff --git a/tests/testsuite/install.rs b/tests/testsuite/install.rs index a2f2a7b021a..92dea6a373b 100644 --- a/tests/testsuite/install.rs +++ b/tests/testsuite/install.rs @@ -1,5 +1,7 @@ //! Tests for the `cargo install` command. +#![allow(deprecated)] + use std::fs::{self, OpenOptions}; use std::io::prelude::*; use std::path::Path; diff --git a/tests/testsuite/install_upgrade.rs b/tests/testsuite/install_upgrade.rs index bd3094a86c4..eca84dce42c 100644 --- a/tests/testsuite/install_upgrade.rs +++ b/tests/testsuite/install_upgrade.rs @@ -1,5 +1,7 @@ //! Tests for `cargo install` where it upgrades a package if it is out-of-date. +#![allow(deprecated)] + use cargo::core::PackageId; use std::collections::BTreeSet; use std::env; diff --git a/tests/testsuite/jobserver.rs b/tests/testsuite/jobserver.rs index 4b5976990f5..5495ca8aa4f 100644 --- a/tests/testsuite/jobserver.rs +++ b/tests/testsuite/jobserver.rs @@ -1,5 +1,7 @@ //! Tests for the jobserver protocol. +#![allow(deprecated)] + use cargo_util::is_ci; use std::env; use std::net::TcpListener; diff --git a/tests/testsuite/lints/implicit_features.rs b/tests/testsuite/lints/implicit_features.rs index 56d70243b96..947850d7973 100644 --- a/tests/testsuite/lints/implicit_features.rs +++ b/tests/testsuite/lints/implicit_features.rs @@ -1,3 +1,5 @@ +#![allow(deprecated)] + use cargo_test_support::project; use cargo_test_support::registry::Package; diff --git a/tests/testsuite/lints/mod.rs b/tests/testsuite/lints/mod.rs index ea1dc25b70f..52fa5ad9f6c 100644 --- a/tests/testsuite/lints/mod.rs +++ b/tests/testsuite/lints/mod.rs @@ -1,3 +1,5 @@ +#![allow(deprecated)] + use cargo_test_support::project; use cargo_test_support::registry::Package; diff --git a/tests/testsuite/lints/unknown_lints.rs b/tests/testsuite/lints/unknown_lints.rs index 16411007539..707719ca4d1 100644 --- a/tests/testsuite/lints/unknown_lints.rs +++ b/tests/testsuite/lints/unknown_lints.rs @@ -1,3 +1,5 @@ +#![allow(deprecated)] + use cargo_test_support::project; #[cargo_test] diff --git a/tests/testsuite/lints/unused_optional_dependencies.rs b/tests/testsuite/lints/unused_optional_dependencies.rs index 1dc22d17567..5f63796606a 100644 --- a/tests/testsuite/lints/unused_optional_dependencies.rs +++ b/tests/testsuite/lints/unused_optional_dependencies.rs @@ -1,3 +1,5 @@ +#![allow(deprecated)] + use cargo_test_support::project; use cargo_test_support::registry::Package; diff --git a/tests/testsuite/lints_table.rs b/tests/testsuite/lints_table.rs index 93f44b5e816..8b6e5cccdce 100644 --- a/tests/testsuite/lints_table.rs +++ b/tests/testsuite/lints_table.rs @@ -1,5 +1,7 @@ //! Tests for `[lints]` +#![allow(deprecated)] + use cargo_test_support::project; use cargo_test_support::registry::Package; diff --git a/tests/testsuite/list_availables.rs b/tests/testsuite/list_availables.rs index ebd6e9c1c7e..833e0373aed 100644 --- a/tests/testsuite/list_availables.rs +++ b/tests/testsuite/list_availables.rs @@ -1,6 +1,8 @@ //! Tests for packages/target filter flags giving suggestions on which //! packages/targets are available. +#![allow(deprecated)] + use cargo_test_support::project; const EXAMPLE: u8 = 1 << 0; diff --git a/tests/testsuite/local_registry.rs b/tests/testsuite/local_registry.rs index b5146863b51..d221f91f45a 100644 --- a/tests/testsuite/local_registry.rs +++ b/tests/testsuite/local_registry.rs @@ -1,5 +1,7 @@ //! Tests for local-registry sources. +#![allow(deprecated)] + use cargo_test_support::paths::{self, CargoPathExt}; use cargo_test_support::registry::{registry_path, Package}; use cargo_test_support::{basic_manifest, project, t}; diff --git a/tests/testsuite/locate_project.rs b/tests/testsuite/locate_project.rs index 7e8ceb4c67a..2e350b1ac2f 100644 --- a/tests/testsuite/locate_project.rs +++ b/tests/testsuite/locate_project.rs @@ -1,5 +1,7 @@ //! Tests for the `cargo locate-project` command. +#![allow(deprecated)] + use cargo_test_support::project; #[cargo_test] diff --git a/tests/testsuite/lockfile_compat.rs b/tests/testsuite/lockfile_compat.rs index 28bd2cb2b65..9496a88f64b 100644 --- a/tests/testsuite/lockfile_compat.rs +++ b/tests/testsuite/lockfile_compat.rs @@ -1,5 +1,7 @@ //! Tests for supporting older versions of the Cargo.lock file format. +#![allow(deprecated)] + use cargo_test_support::compare::assert_e2e; use cargo_test_support::git; use cargo_test_support::registry::Package; diff --git a/tests/testsuite/login.rs b/tests/testsuite/login.rs index 7bfd2b4634b..4d15644a0c4 100644 --- a/tests/testsuite/login.rs +++ b/tests/testsuite/login.rs @@ -1,5 +1,7 @@ //! Tests for the `cargo login` command. +#![allow(deprecated)] + use cargo_test_support::cargo_process; use cargo_test_support::paths::{self, CargoPathExt}; use cargo_test_support::registry::{self, RegistryBuilder}; diff --git a/tests/testsuite/logout.rs b/tests/testsuite/logout.rs index 6829cec2a5f..81a22a96981 100644 --- a/tests/testsuite/logout.rs +++ b/tests/testsuite/logout.rs @@ -1,5 +1,7 @@ //! Tests for the `cargo logout` command. +#![allow(deprecated)] + use super::login::check_token; use cargo_test_support::paths::{self, CargoPathExt}; use cargo_test_support::registry::TestRegistry; diff --git a/tests/testsuite/lto.rs b/tests/testsuite/lto.rs index c6958fc6fe8..c0f7ba427dc 100644 --- a/tests/testsuite/lto.rs +++ b/tests/testsuite/lto.rs @@ -1,3 +1,5 @@ +#![allow(deprecated)] + use cargo::core::compiler::Lto; use cargo_test_support::registry::Package; use cargo_test_support::{basic_manifest, project, Project}; diff --git a/tests/testsuite/member_discovery.rs b/tests/testsuite/member_discovery.rs index c44d5e48f47..694f30c0c9f 100644 --- a/tests/testsuite/member_discovery.rs +++ b/tests/testsuite/member_discovery.rs @@ -1,5 +1,7 @@ //! Tests for workspace member discovery. +#![allow(deprecated)] + use cargo::core::{Shell, Workspace}; use cargo::util::context::GlobalContext; diff --git a/tests/testsuite/member_errors.rs b/tests/testsuite/member_errors.rs index 99c4cb313f2..a4049b0a29a 100644 --- a/tests/testsuite/member_errors.rs +++ b/tests/testsuite/member_errors.rs @@ -1,5 +1,7 @@ //! Tests for workspace member errors. +#![allow(deprecated)] + use cargo::core::resolver::ResolveError; use cargo::core::{compiler::CompileMode, Shell, Workspace}; use cargo::ops::{self, CompileOptions}; diff --git a/tests/testsuite/message_format.rs b/tests/testsuite/message_format.rs index e9310b2616a..3a1e60d21fe 100644 --- a/tests/testsuite/message_format.rs +++ b/tests/testsuite/message_format.rs @@ -1,5 +1,7 @@ //! Tests for --message-format flag. +#![allow(deprecated)] + use cargo_test_support::{basic_lib_manifest, basic_manifest, project}; #[cargo_test] diff --git a/tests/testsuite/messages.rs b/tests/testsuite/messages.rs index 604d77d3268..0b083b5be9e 100644 --- a/tests/testsuite/messages.rs +++ b/tests/testsuite/messages.rs @@ -2,6 +2,8 @@ //! //! Tests for message caching can be found in `cache_messages`. +#![allow(deprecated)] + use cargo_test_support::{process, project, Project}; use cargo_util::ProcessError; diff --git a/tests/testsuite/metabuild.rs b/tests/testsuite/metabuild.rs index f480d577097..be0be9b73e2 100644 --- a/tests/testsuite/metabuild.rs +++ b/tests/testsuite/metabuild.rs @@ -1,5 +1,7 @@ //! Tests for the metabuild feature (declarative build scripts). +#![allow(deprecated)] + use cargo_test_support::{ basic_lib_manifest, basic_manifest, is_coarse_mtime, project, registry::Package, rustc_host, Project, diff --git a/tests/testsuite/metadata.rs b/tests/testsuite/metadata.rs index ca236883316..30a40c0c690 100644 --- a/tests/testsuite/metadata.rs +++ b/tests/testsuite/metadata.rs @@ -1,5 +1,7 @@ //! Tests for the `cargo metadata` command. +#![allow(deprecated)] + use cargo_test_support::install::cargo_home; use cargo_test_support::paths::CargoPathExt; use cargo_test_support::registry::Package; diff --git a/tests/testsuite/minimal_versions.rs b/tests/testsuite/minimal_versions.rs index 4ef2bcfabfa..dc6fe9cd54f 100644 --- a/tests/testsuite/minimal_versions.rs +++ b/tests/testsuite/minimal_versions.rs @@ -2,6 +2,8 @@ //! //! Note: Some tests are located in the resolver-tests package. +#![allow(deprecated)] + use cargo_test_support::project; use cargo_test_support::registry::Package; diff --git a/tests/testsuite/multitarget.rs b/tests/testsuite/multitarget.rs index 68a32dd060e..91c040f10a6 100644 --- a/tests/testsuite/multitarget.rs +++ b/tests/testsuite/multitarget.rs @@ -1,5 +1,7 @@ //! Tests for multiple `--target` flags to subcommands +#![allow(deprecated)] + use cargo_test_support::{basic_manifest, cross_compile, project, rustc_host}; #[cargo_test] diff --git a/tests/testsuite/net_config.rs b/tests/testsuite/net_config.rs index b21595884ba..1892a070f9e 100644 --- a/tests/testsuite/net_config.rs +++ b/tests/testsuite/net_config.rs @@ -1,5 +1,7 @@ //! Tests for network configuration. +#![allow(deprecated)] + use cargo_test_support::project; #[cargo_test] diff --git a/tests/testsuite/new.rs b/tests/testsuite/new.rs index d7a8ab4f7ee..c0a4b18fc5b 100644 --- a/tests/testsuite/new.rs +++ b/tests/testsuite/new.rs @@ -1,5 +1,7 @@ //! Tests for the `cargo new` command. +#![allow(deprecated)] + use cargo_test_support::cargo_process; use cargo_test_support::paths; use std::env; diff --git a/tests/testsuite/offline.rs b/tests/testsuite/offline.rs index 8e6d4e19362..75acd12ffd7 100644 --- a/tests/testsuite/offline.rs +++ b/tests/testsuite/offline.rs @@ -1,5 +1,7 @@ //! Tests for --offline flag. +#![allow(deprecated)] + use cargo_test_support::{ basic_manifest, git, main_file, path2url, project, registry::{Package, RegistryBuilder}, diff --git a/tests/testsuite/old_cargos.rs b/tests/testsuite/old_cargos.rs index 217f733e803..8c810a9fc9f 100644 --- a/tests/testsuite/old_cargos.rs +++ b/tests/testsuite/old_cargos.rs @@ -10,6 +10,8 @@ //! cargo test --test testsuite -- old_cargos --nocapture --ignored //! ``` +#![allow(deprecated)] + use cargo::CargoResult; use cargo_test_support::paths::CargoPathExt; use cargo_test_support::registry::{self, Dependency, Package}; diff --git a/tests/testsuite/open_namespaces.rs b/tests/testsuite/open_namespaces.rs index 1a197260228..607306ef7b8 100644 --- a/tests/testsuite/open_namespaces.rs +++ b/tests/testsuite/open_namespaces.rs @@ -1,3 +1,5 @@ +#![allow(deprecated)] + use cargo_test_support::project; use cargo_test_support::registry::RegistryBuilder; diff --git a/tests/testsuite/owner.rs b/tests/testsuite/owner.rs index fc0e0b5c4e2..251961169d6 100644 --- a/tests/testsuite/owner.rs +++ b/tests/testsuite/owner.rs @@ -1,5 +1,7 @@ //! Tests for the `cargo owner` command. +#![allow(deprecated)] + use std::fs; use cargo_test_support::paths::CargoPathExt; diff --git a/tests/testsuite/package.rs b/tests/testsuite/package.rs index 15e2b7e1248..14d56e02e7a 100644 --- a/tests/testsuite/package.rs +++ b/tests/testsuite/package.rs @@ -1,5 +1,7 @@ //! Tests for the `cargo package` command. +#![allow(deprecated)] + use cargo_test_support::paths::CargoPathExt; use cargo_test_support::publish::validate_crate_contents; use cargo_test_support::registry::{self, Package}; diff --git a/tests/testsuite/package_features.rs b/tests/testsuite/package_features.rs index 2d75bed993f..78fe68dfd41 100644 --- a/tests/testsuite/package_features.rs +++ b/tests/testsuite/package_features.rs @@ -1,5 +1,7 @@ //! Tests for feature selection on the command-line. +#![allow(deprecated)] + use super::features2::switch_to_resolver_2; use cargo_test_support::registry::{Dependency, Package}; use cargo_test_support::{basic_manifest, project}; diff --git a/tests/testsuite/patch.rs b/tests/testsuite/patch.rs index 64adc8a7e44..4872d822f6b 100644 --- a/tests/testsuite/patch.rs +++ b/tests/testsuite/patch.rs @@ -1,5 +1,7 @@ //! Tests for `[patch]` table source replacement. +#![allow(deprecated)] + use cargo_test_support::git; use cargo_test_support::paths; use cargo_test_support::registry::{self, Package}; diff --git a/tests/testsuite/path.rs b/tests/testsuite/path.rs index 6dfef28fd99..2aa08da8231 100644 --- a/tests/testsuite/path.rs +++ b/tests/testsuite/path.rs @@ -1,5 +1,7 @@ //! Tests for `path` dependencies. +#![allow(deprecated)] + use cargo_test_support::paths::{self, CargoPathExt}; use cargo_test_support::registry::Package; use cargo_test_support::{basic_lib_manifest, basic_manifest, main_file, project}; diff --git a/tests/testsuite/paths.rs b/tests/testsuite/paths.rs index 3e46ef6612a..64be03d7373 100644 --- a/tests/testsuite/paths.rs +++ b/tests/testsuite/paths.rs @@ -1,5 +1,7 @@ //! Tests for `paths` overrides. +#![allow(deprecated)] + use cargo_test_support::registry::Package; use cargo_test_support::{basic_manifest, project}; diff --git a/tests/testsuite/pkgid.rs b/tests/testsuite/pkgid.rs index 8bbaa03383e..339a7b87f63 100644 --- a/tests/testsuite/pkgid.rs +++ b/tests/testsuite/pkgid.rs @@ -1,5 +1,7 @@ //! Tests for the `cargo pkgid` command. +#![allow(deprecated)] + use cargo_test_support::basic_lib_manifest; use cargo_test_support::compare::assert_e2e; use cargo_test_support::git; diff --git a/tests/testsuite/precise_pre_release.rs b/tests/testsuite/precise_pre_release.rs index b201858b6fd..c3030fe3934 100644 --- a/tests/testsuite/precise_pre_release.rs +++ b/tests/testsuite/precise_pre_release.rs @@ -1,5 +1,7 @@ //! Tests for selecting pre-release versions with `update --precise`. +#![allow(deprecated)] + use cargo_test_support::project; #[cargo_test] diff --git a/tests/testsuite/proc_macro.rs b/tests/testsuite/proc_macro.rs index 0d793f10c50..9db2f6362e3 100644 --- a/tests/testsuite/proc_macro.rs +++ b/tests/testsuite/proc_macro.rs @@ -1,5 +1,7 @@ //! Tests for proc-macros. +#![allow(deprecated)] + use cargo_test_support::project; #[cargo_test] diff --git a/tests/testsuite/profile_config.rs b/tests/testsuite/profile_config.rs index ef76f72f276..b5cb94d64e7 100644 --- a/tests/testsuite/profile_config.rs +++ b/tests/testsuite/profile_config.rs @@ -1,5 +1,7 @@ //! Tests for profiles defined in config files. +#![allow(deprecated)] + use cargo_test_support::paths::CargoPathExt; use cargo_test_support::registry::Package; use cargo_test_support::{basic_lib_manifest, paths, project}; diff --git a/tests/testsuite/profile_custom.rs b/tests/testsuite/profile_custom.rs index d879507d0ca..f9651232478 100644 --- a/tests/testsuite/profile_custom.rs +++ b/tests/testsuite/profile_custom.rs @@ -1,5 +1,7 @@ //! Tests for named profiles. +#![allow(deprecated)] + use cargo_test_support::paths::CargoPathExt; use cargo_test_support::{basic_lib_manifest, project}; diff --git a/tests/testsuite/profile_overrides.rs b/tests/testsuite/profile_overrides.rs index 5ae33e21c1a..ed1552d3c84 100644 --- a/tests/testsuite/profile_overrides.rs +++ b/tests/testsuite/profile_overrides.rs @@ -1,5 +1,7 @@ //! Tests for profile overrides (build-override and per-package overrides). +#![allow(deprecated)] + use cargo_test_support::registry::Package; use cargo_test_support::{basic_lib_manifest, basic_manifest, project}; diff --git a/tests/testsuite/profile_targets.rs b/tests/testsuite/profile_targets.rs index fee2d8f738a..67a4b8eed38 100644 --- a/tests/testsuite/profile_targets.rs +++ b/tests/testsuite/profile_targets.rs @@ -2,6 +2,8 @@ //! example, the `test` profile applying to test targets, but not other //! targets, etc. +#![allow(deprecated)] + use cargo_test_support::{basic_manifest, project, Project}; fn all_target_project() -> Project { diff --git a/tests/testsuite/profile_trim_paths.rs b/tests/testsuite/profile_trim_paths.rs index 58a3fd15d5d..bc9e9989ee2 100644 --- a/tests/testsuite/profile_trim_paths.rs +++ b/tests/testsuite/profile_trim_paths.rs @@ -1,5 +1,7 @@ //! Tests for `-Ztrim-paths`. +#![allow(deprecated)] + use cargo_test_support::basic_manifest; use cargo_test_support::compare::assert_e2e; use cargo_test_support::git; diff --git a/tests/testsuite/profiles.rs b/tests/testsuite/profiles.rs index b3a9915940c..3a86c6f468f 100644 --- a/tests/testsuite/profiles.rs +++ b/tests/testsuite/profiles.rs @@ -1,5 +1,7 @@ //! Tests for profiles. +#![allow(deprecated)] + use cargo_test_support::registry::Package; use cargo_test_support::{project, rustc_host}; use std::env; diff --git a/tests/testsuite/progress.rs b/tests/testsuite/progress.rs index ffc00d50d43..e68cf580a05 100644 --- a/tests/testsuite/progress.rs +++ b/tests/testsuite/progress.rs @@ -1,5 +1,7 @@ //! Tests for progress bar. +#![allow(deprecated)] + use cargo_test_support::project; use cargo_test_support::registry::Package; diff --git a/tests/testsuite/pub_priv.rs b/tests/testsuite/pub_priv.rs index 14f32b47102..dd9c0675e9d 100644 --- a/tests/testsuite/pub_priv.rs +++ b/tests/testsuite/pub_priv.rs @@ -1,5 +1,7 @@ //! Tests for public/private dependencies. +#![allow(deprecated)] + use cargo_test_support::project; use cargo_test_support::registry::{Dependency, Package}; diff --git a/tests/testsuite/publish.rs b/tests/testsuite/publish.rs index c182b508749..da3efa4259d 100644 --- a/tests/testsuite/publish.rs +++ b/tests/testsuite/publish.rs @@ -1,5 +1,7 @@ //! Tests for the `cargo publish` command. +#![allow(deprecated)] + use cargo_test_support::git::{self, repo}; use cargo_test_support::paths; use cargo_test_support::registry::{self, Package, RegistryBuilder, Response}; diff --git a/tests/testsuite/publish_lockfile.rs b/tests/testsuite/publish_lockfile.rs index 19c783aaab5..24d5c9dfa62 100644 --- a/tests/testsuite/publish_lockfile.rs +++ b/tests/testsuite/publish_lockfile.rs @@ -1,5 +1,7 @@ //! Tests for including `Cargo.lock` when publishing/packaging. +#![allow(deprecated)] + use std::fs::File; use cargo_test_support::registry::Package; diff --git a/tests/testsuite/read_manifest.rs b/tests/testsuite/read_manifest.rs index 6c6b30728d5..4c9410e96b6 100644 --- a/tests/testsuite/read_manifest.rs +++ b/tests/testsuite/read_manifest.rs @@ -1,5 +1,7 @@ //! Tests for the `cargo read-manifest` command. +#![allow(deprecated)] + use cargo_test_support::{basic_bin_manifest, main_file, project}; fn manifest_output(readme_value: &str) -> String { diff --git a/tests/testsuite/registry.rs b/tests/testsuite/registry.rs index e02333c307d..3f9f4ccc189 100644 --- a/tests/testsuite/registry.rs +++ b/tests/testsuite/registry.rs @@ -1,5 +1,7 @@ //! Tests for normal registry dependencies. +#![allow(deprecated)] + use cargo::core::SourceId; use cargo_test_support::cargo_process; use cargo_test_support::paths::{self, CargoPathExt}; diff --git a/tests/testsuite/registry_auth.rs b/tests/testsuite/registry_auth.rs index 12c00998134..6c9ad990279 100644 --- a/tests/testsuite/registry_auth.rs +++ b/tests/testsuite/registry_auth.rs @@ -1,5 +1,7 @@ //! Tests for registry authentication. +#![allow(deprecated)] + use cargo_test_support::compare::assert_e2e; use cargo_test_support::registry::{Package, RegistryBuilder, Token}; use cargo_test_support::str; diff --git a/tests/testsuite/rename_deps.rs b/tests/testsuite/rename_deps.rs index 07027c9efed..b132082a4f8 100644 --- a/tests/testsuite/rename_deps.rs +++ b/tests/testsuite/rename_deps.rs @@ -1,5 +1,7 @@ //! Tests for renaming dependencies. +#![allow(deprecated)] + use cargo_test_support::git; use cargo_test_support::paths; use cargo_test_support::registry::{self, Package}; diff --git a/tests/testsuite/replace.rs b/tests/testsuite/replace.rs index 81b6c379489..d1efedcfbfa 100644 --- a/tests/testsuite/replace.rs +++ b/tests/testsuite/replace.rs @@ -1,5 +1,7 @@ //! Tests for `[replace]` table source replacement. +#![allow(deprecated)] + use cargo_test_support::git; use cargo_test_support::paths; use cargo_test_support::registry::Package; diff --git a/tests/testsuite/required_features.rs b/tests/testsuite/required_features.rs index 10b55275364..5c53c79d4ee 100644 --- a/tests/testsuite/required_features.rs +++ b/tests/testsuite/required_features.rs @@ -1,5 +1,7 @@ //! Tests for targets with `required-features`. +#![allow(deprecated)] + use cargo_test_support::install::{ assert_has_installed_exe, assert_has_not_installed_exe, cargo_home, }; diff --git a/tests/testsuite/run.rs b/tests/testsuite/run.rs index 15ca5591ca2..a3fe4a665cb 100644 --- a/tests/testsuite/run.rs +++ b/tests/testsuite/run.rs @@ -1,5 +1,7 @@ //! Tests for the `cargo run` command. +#![allow(deprecated)] + use cargo_test_support::{ basic_bin_manifest, basic_lib_manifest, basic_manifest, project, Project, }; diff --git a/tests/testsuite/rust_version.rs b/tests/testsuite/rust_version.rs index 399779b19fe..959ad9ea50b 100644 --- a/tests/testsuite/rust_version.rs +++ b/tests/testsuite/rust_version.rs @@ -1,5 +1,7 @@ //! Tests for targets with `rust-version`. +#![allow(deprecated)] + use cargo_test_support::{cargo_process, project, registry::Package}; #[cargo_test] diff --git a/tests/testsuite/rustc.rs b/tests/testsuite/rustc.rs index ae8d317a49b..4d75c91e7c8 100644 --- a/tests/testsuite/rustc.rs +++ b/tests/testsuite/rustc.rs @@ -1,5 +1,7 @@ //! Tests for the `cargo rustc` command. +#![allow(deprecated)] + use cargo_test_support::{basic_bin_manifest, basic_lib_manifest, basic_manifest, project}; const CARGO_RUSTC_ERROR: &str = diff --git a/tests/testsuite/rustc_info_cache.rs b/tests/testsuite/rustc_info_cache.rs index 9747fa3579b..2f825d12d44 100644 --- a/tests/testsuite/rustc_info_cache.rs +++ b/tests/testsuite/rustc_info_cache.rs @@ -1,5 +1,7 @@ //! Tests for the cache file for the rustc version info. +#![allow(deprecated)] + use cargo_test_support::{basic_bin_manifest, paths::CargoPathExt}; use cargo_test_support::{basic_manifest, project}; use std::env; diff --git a/tests/testsuite/rustdoc.rs b/tests/testsuite/rustdoc.rs index 7b72b3621ef..647abce59de 100644 --- a/tests/testsuite/rustdoc.rs +++ b/tests/testsuite/rustdoc.rs @@ -1,5 +1,7 @@ //! Tests for the `cargo rustdoc` command. +#![allow(deprecated)] + use cargo_test_support::{basic_manifest, cross_compile, project}; #[cargo_test] diff --git a/tests/testsuite/rustdoc_extern_html.rs b/tests/testsuite/rustdoc_extern_html.rs index 0d6d93b4962..3f924df3e93 100644 --- a/tests/testsuite/rustdoc_extern_html.rs +++ b/tests/testsuite/rustdoc_extern_html.rs @@ -1,5 +1,7 @@ //! Tests for the -Zrustdoc-map feature. +#![allow(deprecated)] + use cargo_test_support::registry::{self, Package}; use cargo_test_support::{paths, project, Project}; diff --git a/tests/testsuite/rustdocflags.rs b/tests/testsuite/rustdocflags.rs index 09bba09f6f4..7afc8e78bb2 100644 --- a/tests/testsuite/rustdocflags.rs +++ b/tests/testsuite/rustdocflags.rs @@ -1,5 +1,7 @@ //! Tests for setting custom rustdoc flags. +#![allow(deprecated)] + use cargo_test_support::project; use cargo_test_support::rustc_host; use cargo_test_support::rustc_host_env; diff --git a/tests/testsuite/rustflags.rs b/tests/testsuite/rustflags.rs index 564f70c33a3..0b80db3563b 100644 --- a/tests/testsuite/rustflags.rs +++ b/tests/testsuite/rustflags.rs @@ -1,5 +1,7 @@ //! Tests for setting custom rustc flags. +#![allow(deprecated)] + use cargo_test_support::registry::Package; use cargo_test_support::{basic_manifest, paths, project, project_in_home, rustc_host}; use std::fs; diff --git a/tests/testsuite/rustup.rs b/tests/testsuite/rustup.rs index aa93f546c54..dbc7636e7c9 100644 --- a/tests/testsuite/rustup.rs +++ b/tests/testsuite/rustup.rs @@ -1,5 +1,7 @@ //! Tests for Cargo's behavior under Rustup. +#![allow(deprecated)] + use cargo_test_support::paths::{home, root, CargoPathExt}; use cargo_test_support::{cargo_process, process, project}; use std::env; diff --git a/tests/testsuite/script.rs b/tests/testsuite/script.rs index c3abefe455c..12813b25afe 100644 --- a/tests/testsuite/script.rs +++ b/tests/testsuite/script.rs @@ -1,3 +1,5 @@ +#![allow(deprecated)] + use cargo_test_support::basic_manifest; use cargo_test_support::registry::Package; diff --git a/tests/testsuite/search.rs b/tests/testsuite/search.rs index 4daa18f4257..8adf9a6e4a9 100644 --- a/tests/testsuite/search.rs +++ b/tests/testsuite/search.rs @@ -1,5 +1,7 @@ //! Tests for the `cargo search` command. +#![allow(deprecated)] + use cargo::util::cache_lock::CacheLockMode; use cargo_test_support::cargo_process; use cargo_test_support::paths; diff --git a/tests/testsuite/shell_quoting.rs b/tests/testsuite/shell_quoting.rs index bff33338965..edd434d8838 100644 --- a/tests/testsuite/shell_quoting.rs +++ b/tests/testsuite/shell_quoting.rs @@ -2,6 +2,8 @@ //! in the output, their arguments are quoted properly //! so that the command can be run in a terminal. +#![allow(deprecated)] + use cargo_test_support::project; #[cargo_test] diff --git a/tests/testsuite/source_replacement.rs b/tests/testsuite/source_replacement.rs index 7369ad93043..55bf32e04ba 100644 --- a/tests/testsuite/source_replacement.rs +++ b/tests/testsuite/source_replacement.rs @@ -1,5 +1,7 @@ //! Tests for `[source]` table (source replacement). +#![allow(deprecated)] + use std::fs; use cargo_test_support::registry::{Package, RegistryBuilder, TestRegistry}; diff --git a/tests/testsuite/ssh.rs b/tests/testsuite/ssh.rs index 4dad024077c..5a9429ba688 100644 --- a/tests/testsuite/ssh.rs +++ b/tests/testsuite/ssh.rs @@ -5,6 +5,8 @@ //! //! NOTE: The container tests almost certainly won't work on Windows. +#![allow(deprecated)] + use cargo_test_support::containers::{Container, ContainerHandle, MkFile}; use cargo_test_support::git::cargo_uses_gitoxide; use cargo_test_support::{paths, process, project, Project}; diff --git a/tests/testsuite/standard_lib.rs b/tests/testsuite/standard_lib.rs index 82577a57e0b..41d1a0e337a 100644 --- a/tests/testsuite/standard_lib.rs +++ b/tests/testsuite/standard_lib.rs @@ -4,6 +4,8 @@ //! rebuild the real one. There is a separate integration test `build-std` //! which builds the real thing, but that should be avoided if possible. +#![allow(deprecated)] + use cargo_test_support::registry::{Dependency, Package}; use cargo_test_support::ProjectBuilder; use cargo_test_support::{paths, project, rustc_host, Execs}; diff --git a/tests/testsuite/test.rs b/tests/testsuite/test.rs index 1bb352e14d8..4ffac37012d 100644 --- a/tests/testsuite/test.rs +++ b/tests/testsuite/test.rs @@ -1,5 +1,7 @@ //! Tests for the `cargo test` command. +#![allow(deprecated)] + use cargo_test_support::paths::CargoPathExt; use cargo_test_support::registry::Package; use cargo_test_support::{ diff --git a/tests/testsuite/timings.rs b/tests/testsuite/timings.rs index 5ecad19c499..7fcb2495005 100644 --- a/tests/testsuite/timings.rs +++ b/tests/testsuite/timings.rs @@ -1,5 +1,7 @@ //! Tests for --timings. +#![allow(deprecated)] + use cargo_test_support::project; use cargo_test_support::registry::Package; diff --git a/tests/testsuite/tool_paths.rs b/tests/testsuite/tool_paths.rs index d8cbb7f8f2d..ad492cdcd9c 100644 --- a/tests/testsuite/tool_paths.rs +++ b/tests/testsuite/tool_paths.rs @@ -1,5 +1,7 @@ //! Tests for configuration values that point to programs. +#![allow(deprecated)] + use cargo_test_support::{basic_lib_manifest, project, rustc_host, rustc_host_env}; #[cargo_test] diff --git a/tests/testsuite/tree.rs b/tests/testsuite/tree.rs index 16cc37f7e56..d9624300654 100644 --- a/tests/testsuite/tree.rs +++ b/tests/testsuite/tree.rs @@ -1,5 +1,7 @@ //! Tests for the `cargo tree` command. +#![allow(deprecated)] + use super::features2::switch_to_resolver_2; use cargo_test_support::cross_compile::{self, alternate}; use cargo_test_support::registry::{Dependency, Package}; diff --git a/tests/testsuite/tree_graph_features.rs b/tests/testsuite/tree_graph_features.rs index 48d654c066d..1d4d47a08ac 100644 --- a/tests/testsuite/tree_graph_features.rs +++ b/tests/testsuite/tree_graph_features.rs @@ -1,5 +1,7 @@ //! Tests for the `cargo tree` command with -e features option. +#![allow(deprecated)] + use cargo_test_support::project; use cargo_test_support::registry::{Dependency, Package}; diff --git a/tests/testsuite/unit_graph.rs b/tests/testsuite/unit_graph.rs index 2b62262da19..a64f6a2df50 100644 --- a/tests/testsuite/unit_graph.rs +++ b/tests/testsuite/unit_graph.rs @@ -1,5 +1,7 @@ //! Tests for --unit-graph option. +#![allow(deprecated)] + use cargo_test_support::project; use cargo_test_support::registry::Package; diff --git a/tests/testsuite/update.rs b/tests/testsuite/update.rs index 15f0f9e5b09..17e151755e5 100644 --- a/tests/testsuite/update.rs +++ b/tests/testsuite/update.rs @@ -1,5 +1,7 @@ //! Tests for the `cargo update` command. +#![allow(deprecated)] + use cargo_test_support::compare::assert_e2e; use cargo_test_support::registry::{self}; use cargo_test_support::registry::{Dependency, Package}; diff --git a/tests/testsuite/vendor.rs b/tests/testsuite/vendor.rs index 4d151473490..9716b448d71 100644 --- a/tests/testsuite/vendor.rs +++ b/tests/testsuite/vendor.rs @@ -4,6 +4,8 @@ //! "fake" crates.io is used. Otherwise `vendor` would download the crates.io //! index from the network. +#![allow(deprecated)] + use std::fs; use cargo_test_support::compare::assert_e2e; diff --git a/tests/testsuite/verify_project.rs b/tests/testsuite/verify_project.rs index 216808fb52d..4b0450a7a61 100644 --- a/tests/testsuite/verify_project.rs +++ b/tests/testsuite/verify_project.rs @@ -1,5 +1,7 @@ //! Tests for the `cargo verify-project` command. +#![allow(deprecated)] + use cargo_test_support::{basic_bin_manifest, main_file, project}; fn verify_project_success_output() -> String { diff --git a/tests/testsuite/version.rs b/tests/testsuite/version.rs index b1738ef0bd8..008f15db6b9 100644 --- a/tests/testsuite/version.rs +++ b/tests/testsuite/version.rs @@ -1,5 +1,7 @@ //! Tests for displaying the cargo version. +#![allow(deprecated)] + use cargo_test_support::{cargo_process, project}; #[cargo_test] diff --git a/tests/testsuite/warn_on_failure.rs b/tests/testsuite/warn_on_failure.rs index 967ffacaf13..707a9d1d622 100644 --- a/tests/testsuite/warn_on_failure.rs +++ b/tests/testsuite/warn_on_failure.rs @@ -1,5 +1,7 @@ //! Tests for whether or not warnings are displayed for build scripts. +#![allow(deprecated)] + use cargo_test_support::registry::Package; use cargo_test_support::{project, Project}; diff --git a/tests/testsuite/weak_dep_features.rs b/tests/testsuite/weak_dep_features.rs index 3645b6b45bb..c05c13bdaae 100644 --- a/tests/testsuite/weak_dep_features.rs +++ b/tests/testsuite/weak_dep_features.rs @@ -1,5 +1,7 @@ //! Tests for weak-dep-features. +#![allow(deprecated)] + use super::features2::switch_to_resolver_2; use cargo_test_support::paths::CargoPathExt; use cargo_test_support::registry::{Dependency, Package, RegistryBuilder}; diff --git a/tests/testsuite/workspaces.rs b/tests/testsuite/workspaces.rs index eccc848853a..9acc3b56832 100644 --- a/tests/testsuite/workspaces.rs +++ b/tests/testsuite/workspaces.rs @@ -1,5 +1,7 @@ //! Tests for workspaces. +#![allow(deprecated)] + use cargo_test_support::registry::Package; use cargo_test_support::{basic_lib_manifest, basic_manifest, git, project, sleep_ms}; use std::env; diff --git a/tests/testsuite/yank.rs b/tests/testsuite/yank.rs index 9aff2fc8421..2f0f977ccdf 100644 --- a/tests/testsuite/yank.rs +++ b/tests/testsuite/yank.rs @@ -1,5 +1,7 @@ //! Tests for the `cargo yank` command. +#![allow(deprecated)] + use std::fs; use cargo_test_support::paths::CargoPathExt; From 7f90d9acdba5fb53c671d62b625ac5cef73a4eed Mon Sep 17 00:00:00 2001 From: Ed Page Date: Fri, 7 Jun 2024 14:57:33 -0500 Subject: [PATCH 09/10] test: Resolve advanced_env deprecations --- tests/testsuite/advanced_env.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/testsuite/advanced_env.rs b/tests/testsuite/advanced_env.rs index d1a55229269..fb65839a205 100644 --- a/tests/testsuite/advanced_env.rs +++ b/tests/testsuite/advanced_env.rs @@ -1,7 +1,5 @@ //! -Zadvanced-env tests -#![allow(deprecated)] - use cargo_test_support::{paths, project, registry::Package}; #[cargo_test] From e589ed7f59c1302ce486320ccdd114914084f887 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Fri, 7 Jun 2024 15:04:48 -0500 Subject: [PATCH 10/10] test: Resolve alt_registry deprecations --- tests/testsuite/alt_registry.rs | 1432 +++++++++++++++++++------------ 1 file changed, 868 insertions(+), 564 deletions(-) diff --git a/tests/testsuite/alt_registry.rs b/tests/testsuite/alt_registry.rs index f012e26932e..76f2c1b07fa 100644 --- a/tests/testsuite/alt_registry.rs +++ b/tests/testsuite/alt_registry.rs @@ -1,8 +1,7 @@ //! Tests for alternative registries. -#![allow(deprecated)] - use cargo_test_support::compare::assert_e2e; +use cargo_test_support::prelude::*; use cargo_test_support::publish::validate_alt_upload; use cargo_test_support::registry::{self, Package, RegistryBuilder}; use cargo_test_support::str; @@ -33,30 +32,28 @@ fn depend_on_alt_registry() { Package::new("bar", "0.0.1").alternative(true).publish(); p.cargo("check") - .with_stderr( - "\ + .with_stderr_data(str![[r#" [UPDATING] `alternative` index [LOCKING] 2 packages to latest compatible versions [DOWNLOADING] crates ... [DOWNLOADED] bar v0.0.1 (registry `alternative`) [CHECKING] bar v0.0.1 (registry `alternative`) -[CHECKING] foo v0.0.1 ([CWD]) -[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]s -", - ) +[CHECKING] foo v0.0.1 ([ROOT]/foo) +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]) .run(); p.cargo("clean").run(); // Don't download a second time p.cargo("check") - .with_stderr( - "\ + .with_stderr_data(str![[r#" [CHECKING] bar v0.0.1 (registry `alternative`) -[CHECKING] foo v0.0.1 ([CWD]) -[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]s -", - ) +[CHECKING] foo v0.0.1 ([ROOT]/foo) +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]) .run(); } @@ -88,19 +85,18 @@ fn depend_on_alt_registry_depends_on_same_registry_no_index() { .publish(); p.cargo("check") - .with_stderr( - "\ + .with_stderr_data(str![[r#" [UPDATING] `alternative` index [LOCKING] 3 packages to latest compatible versions [DOWNLOADING] crates ... -[DOWNLOADED] [..] v0.0.1 (registry `alternative`) -[DOWNLOADED] [..] v0.0.1 (registry `alternative`) +[DOWNLOADED] baz v0.0.1 (registry `alternative`) +[DOWNLOADED] bar v0.0.1 (registry `alternative`) [CHECKING] baz v0.0.1 (registry `alternative`) [CHECKING] bar v0.0.1 (registry `alternative`) -[CHECKING] foo v0.0.1 ([CWD]) -[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]s -", - ) +[CHECKING] foo v0.0.1 ([ROOT]/foo) +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]) .run(); } @@ -132,19 +128,18 @@ fn depend_on_alt_registry_depends_on_same_registry() { .publish(); p.cargo("check") - .with_stderr( - "\ + .with_stderr_data(str![[r#" [UPDATING] `alternative` index [LOCKING] 3 packages to latest compatible versions [DOWNLOADING] crates ... -[DOWNLOADED] [..] v0.0.1 (registry `alternative`) -[DOWNLOADED] [..] v0.0.1 (registry `alternative`) +[DOWNLOADED] baz v0.0.1 (registry `alternative`) +[DOWNLOADED] bar v0.0.1 (registry `alternative`) [CHECKING] baz v0.0.1 (registry `alternative`) [CHECKING] bar v0.0.1 (registry `alternative`) -[CHECKING] foo v0.0.1 ([CWD]) -[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]s -", - ) +[CHECKING] foo v0.0.1 ([ROOT]/foo) +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]) .run(); } @@ -176,8 +171,8 @@ fn depend_on_alt_registry_depends_on_crates_io() { .publish(); p.cargo("check") - .with_stderr_unordered( - "\ + .with_stderr_data( + str![[r#" [UPDATING] `alternative` index [UPDATING] `dummy-registry` index [LOCKING] 3 packages to latest compatible versions @@ -186,9 +181,11 @@ fn depend_on_alt_registry_depends_on_crates_io() { [DOWNLOADED] bar v0.0.1 (registry `alternative`) [CHECKING] baz v0.0.1 [CHECKING] bar v0.0.1 (registry `alternative`) -[CHECKING] foo v0.0.1 ([CWD]) -[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]s -", +[CHECKING] foo v0.0.1 ([ROOT]/foo) +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]] + .unordered(), ) .run(); } @@ -218,14 +215,13 @@ fn registry_and_path_dep_works() { .build(); p.cargo("check") - .with_stderr( - "\ + .with_stderr_data(str![[r#" [LOCKING] 2 packages to latest compatible versions -[CHECKING] bar v0.0.1 ([CWD]/bar) -[CHECKING] foo v0.0.1 ([CWD]) -[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]s -", - ) +[CHECKING] bar v0.0.1 ([ROOT]/foo/bar) +[CHECKING] foo v0.0.1 ([ROOT]/foo) +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]) .run(); } @@ -253,10 +249,13 @@ fn registry_incompatible_with_git() { p.cargo("check") .with_status(101) - .with_stderr_contains( - " dependency (bar) specification is ambiguous. \ - Only one of `git` or `registry` is allowed.", - ) + .with_stderr_data(str![[r#" +[ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml` + +Caused by: + dependency (bar) specification is ambiguous. Only one of `git` or `registry` is allowed. + +"#]]) .run(); } @@ -286,7 +285,13 @@ fn cannot_publish_to_crates_io_with_registry_dependency() { p.cargo("publish") .replace_crates_io(crates_io.index_url()) .with_status(101) - .with_stderr_contains("[ERROR] crates cannot be published to crates.io[..]") + .with_stderr_data(str![[r#" +[UPDATING] crates.io index +[ERROR] crates cannot be published to crates.io with dependencies sourced from other +registries. `bar` needs to be published to crates.io before publishing this crate. +(crate `bar` is pulled from registry `alternative`) + +"#]]) .run(); p.cargo("publish") @@ -296,7 +301,13 @@ fn cannot_publish_to_crates_io_with_registry_dependency() { .arg("--index") .arg(crates_io.index_url().as_str()) .with_status(101) - .with_stderr_contains("[ERROR] crates cannot be published to crates.io[..]") + .with_stderr_data(str![[r#" +[UPDATING] crates.io index +[ERROR] crates cannot be published to crates.io with dependencies sourced from other +registries. `bar` needs to be published to crates.io before publishing this crate. +(crate `bar` is pulled from registry `alternative`) + +"#]]) .run(); } @@ -329,27 +340,26 @@ fn publish_with_registry_dependency() { Package::new("bar", "0.0.1").alternative(true).publish(); p.cargo("publish --registry alternative") - .with_stderr( - "\ + .with_stderr_data(str![[r#" [UPDATING] `alternative` index -[WARNING] [..] -[..] -[PACKAGING] foo v0.0.1 [..] +[WARNING] manifest has no description, license, license-file, documentation, homepage or repository. +See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info. +[PACKAGING] foo v0.0.1 ([ROOT]/foo) [UPDATING] `alternative` index -[VERIFYING] foo v0.0.1 [..] -[DOWNLOADING] [..] +[VERIFYING] foo v0.0.1 ([ROOT]/foo) +[DOWNLOADING] crates ... [DOWNLOADED] bar v0.0.1 (registry `alternative`) [COMPILING] bar v0.0.1 (registry `alternative`) -[COMPILING] foo v0.0.1 [..] -[FINISHED] [..] -[PACKAGED] [..] -[UPLOADING] foo v0.0.1 [..] +[COMPILING] foo v0.0.1 ([ROOT]/foo/target/package/foo-0.0.1) +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s +[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed) +[UPLOADING] foo v0.0.1 ([ROOT]/foo) [UPLOADED] foo v0.0.1 to registry `alternative` [NOTE] waiting for `foo v0.0.1` to be available at registry `alternative`. You may press ctrl-c to skip waiting; the crate should be available shortly. [PUBLISHED] foo v0.0.1 at registry `alternative` -", - ) + +"#]]) .run(); validate_alt_upload( @@ -420,19 +430,21 @@ fn alt_registry_and_crates_io_deps() { .publish(); p.cargo("check") - .with_stderr_unordered( - "\ + .with_stderr_data( + str![[r#" [UPDATING] `alternative` index [UPDATING] `dummy-registry` index [LOCKING] 3 packages to latest compatible versions [DOWNLOADING] crates ... [DOWNLOADED] crates_io_dep v0.0.1 (registry `dummy-registry`) [DOWNLOADED] alt_reg_dep v0.1.0 (registry `alternative`) -[CHECKING] alt_reg_dep v0.1.0 (registry `alternative`) [CHECKING] crates_io_dep v0.0.1 -[CHECKING] foo v0.0.1 ([CWD]) -[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]s -", +[CHECKING] alt_reg_dep v0.1.0 (registry `alternative`) +[CHECKING] foo v0.0.1 ([ROOT]/foo) +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]] + .unordered(), ) .run(); } @@ -447,12 +459,12 @@ fn block_publish_due_to_no_token() { // Now perform the actual publish p.cargo("publish --registry alternative") .with_status(101) - .with_stderr( - "\ + .with_stderr_data(str![[r#" [UPDATING] `alternative` index -error: no token found for `alternative`, please run `cargo login --registry alternative` -or use environment variable CARGO_REGISTRIES_ALTERNATIVE_TOKEN", - ) +[ERROR] no token found for `alternative`, please run `cargo login --registry alternative` +or use environment variable CARGO_REGISTRIES_ALTERNATIVE_TOKEN + +"#]]) .run(); } @@ -474,12 +486,12 @@ fn cargo_registries_crates_io_protocol() { p.cargo("publish --registry alternative") .with_status(101) - .with_stderr( - "\ + .with_stderr_data(str![[r#" [UPDATING] `alternative` index -error: no token found for `alternative`, please run `cargo login --registry alternative` -or use environment variable CARGO_REGISTRIES_ALTERNATIVE_TOKEN", - ) +[ERROR] no token found for `alternative`, please run `cargo login --registry alternative` +or use environment variable CARGO_REGISTRIES_ALTERNATIVE_TOKEN + +"#]]) .run(); } @@ -495,23 +507,22 @@ fn publish_to_alt_registry() { // Now perform the actual publish p.cargo("publish --registry alternative") - .with_stderr( - "\ + .with_stderr_data(str![[r#" [UPDATING] `alternative` index -[WARNING] [..] -[..] -[PACKAGING] foo v0.0.1 [..] -[VERIFYING] foo v0.0.1 [..] -[COMPILING] foo v0.0.1 [..] -[FINISHED] [..] -[PACKAGED] [..] -[UPLOADING] foo v0.0.1 [..] +[WARNING] manifest has no description, license, license-file, documentation, homepage or repository. +See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info. +[PACKAGING] foo v0.0.1 ([ROOT]/foo) +[VERIFYING] foo v0.0.1 ([ROOT]/foo) +[COMPILING] foo v0.0.1 ([ROOT]/foo/target/package/foo-0.0.1) +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s +[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed) +[UPLOADING] foo v0.0.1 ([ROOT]/foo) [UPLOADED] foo v0.0.1 to registry `alternative` [NOTE] waiting for `foo v0.0.1` to be available at registry `alternative`. You may press ctrl-c to skip waiting; the crate should be available shortly. [PUBLISHED] foo v0.0.1 at registry `alternative` -", - ) + +"#]]) .run(); validate_alt_upload( @@ -574,27 +585,26 @@ fn publish_with_crates_io_dep() { Package::new("bar", "0.0.1").publish(); p.cargo("publish --registry alternative") - .with_stderr( - "\ + .with_stderr_data(str![[r#" [UPDATING] `alternative` index -[WARNING] [..] -[..] -[PACKAGING] foo v0.0.1 [..] +[WARNING] manifest has no documentation, homepage or repository. +See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info. +[PACKAGING] foo v0.0.1 ([ROOT]/foo) [UPDATING] `dummy-registry` index -[VERIFYING] foo v0.0.1 [..] -[DOWNLOADING] [..] +[VERIFYING] foo v0.0.1 ([ROOT]/foo) +[DOWNLOADING] crates ... [DOWNLOADED] bar v0.0.1 (registry `dummy-registry`) [COMPILING] bar v0.0.1 -[COMPILING] foo v0.0.1 [..] -[FINISHED] [..] -[PACKAGED] [..] -[UPLOADING] foo v0.0.1 [..] +[COMPILING] foo v0.0.1 ([ROOT]/foo/target/package/foo-0.0.1) +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s +[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed) +[UPLOADING] foo v0.0.1 ([ROOT]/foo) [UPLOADED] foo v0.0.1 to registry `alternative` [NOTE] waiting for `foo v0.0.1` to be available at registry `alternative`. You may press ctrl-c to skip waiting; the crate should be available shortly. [PUBLISHED] foo v0.0.1 at registry `alternative` -", - ) + +"#]]) .run(); validate_alt_upload( @@ -655,14 +665,13 @@ fn passwords_in_registries_index_url_forbidden() { p.cargo("publish --registry alternative") .with_status(101) - .with_stderr( - "\ -error: invalid index URL for registry `alternative` defined in [..]/home/.cargo/config.toml + .with_stderr_data(str![[r#" +[ERROR] invalid index URL for registry `alternative` defined in [ROOT]/home/.cargo/config.toml Caused by: registry URLs may not contain passwords -", - ) + +"#]]) .run(); } @@ -698,15 +707,14 @@ fn patch_alt_reg() { .build(); p.cargo("check") - .with_stderr( - "\ + .with_stderr_data(str![[r#" [UPDATING] `alternative` index [LOCKING] 2 packages to latest compatible versions -[CHECKING] bar v0.1.0 ([CWD]/bar) -[CHECKING] foo v0.0.1 ([CWD]) -[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..] -", - ) +[CHECKING] bar v0.1.0 ([ROOT]/foo/bar) +[CHECKING] foo v0.0.1 ([ROOT]/foo) +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]) .run(); } @@ -732,8 +740,7 @@ fn bad_registry_name() { p.cargo("build") .with_status(101) - .with_stderr( - "\ + .with_stderr_data(str![[r#" [ERROR] invalid character ` ` in registry name: `bad name`, characters must be Unicode XID characters (numbers, `-`, `_`, or most letters) @@ -741,12 +748,12 @@ fn bad_registry_name() { | 8 | [dependencies.bar] | _________________^ - 9 | | version = \"0.0.1\" -10 | | registry = \"bad name\" + 9 | | version = "0.0.1" +10 | | registry = "bad name" | |_____________________________________^ | -", - ) + +"#]]) .run(); for cmd in &[ @@ -762,7 +769,10 @@ fn bad_registry_name() { .arg("--registry") .arg("bad name") .with_status(101) - .with_stderr("[ERROR] invalid character ` ` in registry name: `bad name`, [..]") + .with_stderr_data(str![[r#" +[ERROR] invalid character ` ` in registry name: `bad name`, characters must be Unicode XID characters (numbers, `-`, `_`, or most letters) + +"#]]) .run(); } } @@ -791,50 +801,68 @@ fn no_api() { .build(); p.cargo("check") - .with_stderr( - "\ + .with_stderr_data(str![[r#" [UPDATING] `alternative` index [LOCKING] 2 packages to latest compatible versions [DOWNLOADING] crates ... [DOWNLOADED] bar v0.0.1 (registry `alternative`) [CHECKING] bar v0.0.1 (registry `alternative`) -[CHECKING] foo v0.0.1 ([CWD]) -[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]s -", - ) - .run(); +[CHECKING] foo v0.0.1 ([ROOT]/foo) +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s - // Check all of the API commands. - let err = "[ERROR] registry `alternative` does not support API commands"; +"#]]) + .run(); p.cargo("login --registry alternative TOKEN") .with_status(101) - .with_stderr_contains(&err) + .with_stderr_data(str![[r#" +[ERROR] registry `alternative` does not support API commands + +"#]]) .run(); p.cargo("publish --registry alternative") .with_status(101) - .with_stderr_contains(&err) + .with_stderr_data(str![[r#" +[UPDATING] `alternative` index +[ERROR] registry `alternative` does not support API commands + +"#]]) .run(); p.cargo("search --registry alternative") .with_status(101) - .with_stderr_contains(&err) + .with_stderr_data(str![[r#" +[ERROR] registry `alternative` does not support API commands + +"#]]) .run(); p.cargo("owner --registry alternative --list") .with_status(101) - .with_stderr_contains(&err) + .with_stderr_data(str![[r#" +[UPDATING] `alternative` index +[ERROR] registry `alternative` does not support API commands + +"#]]) .run(); p.cargo("yank --registry alternative --version=0.0.1 bar") .with_status(101) - .with_stderr_contains(&err) + .with_stderr_data(str![[r#" +[UPDATING] `alternative` index +[ERROR] registry `alternative` does not support API commands + +"#]]) .run(); p.cargo("yank --registry alternative --version=0.0.1 bar") - .with_stderr_contains(&err) .with_status(101) + .with_stderr_data(str![[r#" +[UPDATING] `alternative` index +[ERROR] registry `alternative` does not support API commands + +"#]]) .run(); } @@ -876,277 +904,455 @@ fn alt_reg_metadata() { // altdep -> bar: null (because it is in crates.io) // iodep -> altdep2: alternative-registry p.cargo("metadata --format-version=1 --no-deps") - .with_json( - r#" - { - "packages": [ - { - "name": "foo", - "version": "0.0.1", - "id": "path+file:[..]/foo#0.0.1", - "license": null, - "license_file": null, - "description": null, - "source": null, - "dependencies": [ - { - "name": "altdep", - "source": "registry+file:[..]/alternative-registry", - "req": "^0.0.1", - "kind": null, - "rename": null, - "optional": false, - "uses_default_features": true, - "features": [], - "target": null, - "registry": "file:[..]/alternative-registry" - }, - { - "name": "iodep", - "source": "registry+https://github.com/rust-lang/crates.io-index", - "req": "^0.0.1", - "kind": null, - "rename": null, - "optional": false, - "uses_default_features": true, - "features": [], - "target": null, - "registry": null - } - ], - "targets": "{...}", - "features": {}, - "manifest_path": "[..]/foo/Cargo.toml", - "metadata": null, - "publish": null, - "authors": [], - "categories": [], - "default_run": null, - "keywords": [], - "readme": null, - "repository": null, - "rust_version": null, - "homepage": null, - "documentation": null, - "edition": "2015", - "links": null - } - ], - "workspace_members": [ - "path+file:[..]/foo#0.0.1" - ], - "workspace_default_members": [ - "path+file:[..]/foo#0.0.1" - ], - "resolve": null, - "target_directory": "[..]/foo/target", - "version": 1, - "workspace_root": "[..]/foo", - "metadata": null - }"#, + .with_stdout_data( + str![[r#" +{ + "metadata": null, + "packages": [ + { + "authors": [], + "categories": [], + "default_run": null, + "dependencies": [ + { + "features": [], + "kind": null, + "name": "altdep", + "optional": false, + "registry": "[ROOTURL]/alternative-registry", + "rename": null, + "req": "^0.0.1", + "source": "registry+[ROOTURL]/alternative-registry", + "target": null, + "uses_default_features": true + }, + { + "features": [], + "kind": null, + "name": "iodep", + "optional": false, + "registry": null, + "rename": null, + "req": "^0.0.1", + "source": "registry+https://github.com/rust-lang/crates.io-index", + "target": null, + "uses_default_features": true + } + ], + "description": null, + "documentation": null, + "edition": "2015", + "features": {}, + "homepage": null, + "id": "path+[ROOTURL]/foo#0.0.1", + "keywords": [], + "license": null, + "license_file": null, + "links": null, + "manifest_path": "[ROOT]/foo/Cargo.toml", + "metadata": null, + "name": "foo", + "publish": null, + "readme": null, + "repository": null, + "rust_version": null, + "source": null, + "targets": [ + { + "crate_types": [ + "lib" + ], + "doc": true, + "doctest": true, + "edition": "2015", + "kind": [ + "lib" + ], + "name": "foo", + "src_path": "[ROOT]/foo/src/lib.rs", + "test": true + } + ], + "version": "0.0.1" + } + ], + "resolve": null, + "target_directory": "[ROOT]/foo/target", + "version": 1, + "workspace_default_members": [ + "path+[ROOTURL]/foo#0.0.1" + ], + "workspace_members": [ + "path+[ROOTURL]/foo#0.0.1" + ], + "workspace_root": "[ROOT]/foo" +} +"#]] + .json(), ) .run(); // --no-deps uses a different code path, make sure both work. p.cargo("metadata --format-version=1") - .with_json( - r#" - { - "packages": [ - { - "name": "altdep", - "version": "0.0.1", - "id": "registry+file:[..]/alternative-registry#altdep@0.0.1", - "license": null, - "license_file": null, - "description": null, - "source": "registry+file:[..]/alternative-registry", - "dependencies": [ - { - "name": "bar", - "source": "registry+https://github.com/rust-lang/crates.io-index", - "req": "^0.0.1", - "kind": null, - "rename": null, - "optional": false, - "uses_default_features": true, - "features": [], - "target": null, - "registry": null - } - ], - "targets": "{...}", - "features": {}, - "manifest_path": "[..]/altdep-0.0.1/Cargo.toml", - "metadata": null, - "publish": null, - "authors": [], - "categories": [], - "default_run": null, - "keywords": [], - "readme": null, - "repository": null, - "rust_version": null, - "homepage": null, - "documentation": null, - "edition": "2015", - "links": null - }, - { - "name": "altdep2", - "version": "0.0.1", - "id": "registry+file:[..]/alternative-registry#altdep2@0.0.1", - "license": null, - "license_file": null, - "description": null, - "source": "registry+file:[..]/alternative-registry", - "dependencies": [], - "targets": "{...}", - "features": {}, - "manifest_path": "[..]/altdep2-0.0.1/Cargo.toml", - "metadata": null, - "publish": null, - "authors": [], - "categories": [], - "default_run": null, - "keywords": [], - "readme": null, - "repository": null, - "rust_version": null, - "homepage": null, - "documentation": null, - "edition": "2015", - "links": null - }, - { - "name": "bar", - "version": "0.0.1", - "id": "registry+https://github.com/rust-lang/crates.io-index#bar@0.0.1", - "license": null, - "license_file": null, - "description": null, - "source": "registry+https://github.com/rust-lang/crates.io-index", - "dependencies": [], - "targets": "{...}", - "features": {}, - "manifest_path": "[..]/bar-0.0.1/Cargo.toml", - "metadata": null, - "publish": null, - "authors": [], - "categories": [], - "default_run": null, - "keywords": [], - "readme": null, - "repository": null, - "rust_version": null, - "homepage": null, - "documentation": null, - "edition": "2015", - "links": null - }, - { - "name": "foo", - "version": "0.0.1", - "id": "path+file:[..]/foo#0.0.1", - "license": null, - "license_file": null, - "description": null, - "source": null, - "dependencies": [ - { - "name": "altdep", - "source": "registry+file:[..]/alternative-registry", - "req": "^0.0.1", - "kind": null, - "rename": null, - "optional": false, - "uses_default_features": true, - "features": [], - "target": null, - "registry": "file:[..]/alternative-registry" - }, - { - "name": "iodep", - "source": "registry+https://github.com/rust-lang/crates.io-index", - "req": "^0.0.1", - "kind": null, - "rename": null, - "optional": false, - "uses_default_features": true, - "features": [], - "target": null, - "registry": null - } - ], - "targets": "{...}", - "features": {}, - "manifest_path": "[..]/foo/Cargo.toml", - "metadata": null, - "publish": null, - "authors": [], - "categories": [], - "default_run": null, - "keywords": [], - "readme": null, - "repository": null, - "rust_version": null, - "homepage": null, - "documentation": null, - "edition": "2015", - "links": null - }, - { - "name": "iodep", - "version": "0.0.1", - "id": "registry+https://github.com/rust-lang/crates.io-index#iodep@0.0.1", - "license": null, - "license_file": null, - "description": null, - "source": "registry+https://github.com/rust-lang/crates.io-index", - "dependencies": [ - { - "name": "altdep2", - "source": "registry+file:[..]/alternative-registry", - "req": "^0.0.1", - "kind": null, - "rename": null, - "optional": false, - "uses_default_features": true, - "features": [], - "target": null, - "registry": "file:[..]/alternative-registry" - } - ], - "targets": "{...}", - "features": {}, - "manifest_path": "[..]/iodep-0.0.1/Cargo.toml", - "metadata": null, - "publish": null, - "authors": [], - "categories": [], - "default_run": null, - "keywords": [], - "readme": null, - "repository": null, - "rust_version": null, - "homepage": null, - "documentation": null, - "edition": "2015", - "links": null - } - ], - "workspace_members": [ - "path+file:[..]/foo#0.0.1" - ], - "workspace_default_members": [ - "path+file:[..]/foo#0.0.1" - ], - "resolve": "{...}", - "target_directory": "[..]/foo/target", - "version": 1, - "workspace_root": "[..]/foo", - "metadata": null - }"#, + .with_stdout_data( + str![[r#" +{ + "metadata": null, + "packages": [ + { + "authors": [], + "categories": [], + "default_run": null, + "dependencies": [ + { + "features": [], + "kind": null, + "name": "bar", + "optional": false, + "registry": null, + "rename": null, + "req": "^0.0.1", + "source": "registry+https://github.com/rust-lang/crates.io-index", + "target": null, + "uses_default_features": true + } + ], + "description": null, + "documentation": null, + "edition": "2015", + "features": {}, + "homepage": null, + "id": "registry+[ROOTURL]/alternative-registry#altdep@0.0.1", + "keywords": [], + "license": null, + "license_file": null, + "links": null, + "manifest_path": "[ROOT]/home/.cargo/registry/src/-[HASH]/altdep-0.0.1/Cargo.toml", + "metadata": null, + "name": "altdep", + "publish": null, + "readme": null, + "repository": null, + "rust_version": null, + "source": "registry+[ROOTURL]/alternative-registry", + "targets": [ + { + "crate_types": [ + "lib" + ], + "doc": true, + "doctest": true, + "edition": "2015", + "kind": [ + "lib" + ], + "name": "altdep", + "src_path": "[ROOT]/home/.cargo/registry/src/-[HASH]/altdep-0.0.1/src/lib.rs", + "test": true + } + ], + "version": "0.0.1" + }, + { + "authors": [], + "categories": [], + "default_run": null, + "dependencies": [], + "description": null, + "documentation": null, + "edition": "2015", + "features": {}, + "homepage": null, + "id": "registry+[ROOTURL]/alternative-registry#altdep2@0.0.1", + "keywords": [], + "license": null, + "license_file": null, + "links": null, + "manifest_path": "[ROOT]/home/.cargo/registry/src/-[HASH]/altdep2-0.0.1/Cargo.toml", + "metadata": null, + "name": "altdep2", + "publish": null, + "readme": null, + "repository": null, + "rust_version": null, + "source": "registry+[ROOTURL]/alternative-registry", + "targets": [ + { + "crate_types": [ + "lib" + ], + "doc": true, + "doctest": true, + "edition": "2015", + "kind": [ + "lib" + ], + "name": "altdep2", + "src_path": "[ROOT]/home/.cargo/registry/src/-[HASH]/altdep2-0.0.1/src/lib.rs", + "test": true + } + ], + "version": "0.0.1" + }, + { + "authors": [], + "categories": [], + "default_run": null, + "dependencies": [], + "description": null, + "documentation": null, + "edition": "2015", + "features": {}, + "homepage": null, + "id": "registry+https://github.com/rust-lang/crates.io-index#bar@0.0.1", + "keywords": [], + "license": null, + "license_file": null, + "links": null, + "manifest_path": "[ROOT]/home/.cargo/registry/src/-[HASH]/bar-0.0.1/Cargo.toml", + "metadata": null, + "name": "bar", + "publish": null, + "readme": null, + "repository": null, + "rust_version": null, + "source": "registry+https://github.com/rust-lang/crates.io-index", + "targets": [ + { + "crate_types": [ + "lib" + ], + "doc": true, + "doctest": true, + "edition": "2015", + "kind": [ + "lib" + ], + "name": "bar", + "src_path": "[ROOT]/home/.cargo/registry/src/-[HASH]/bar-0.0.1/src/lib.rs", + "test": true + } + ], + "version": "0.0.1" + }, + { + "authors": [], + "categories": [], + "default_run": null, + "dependencies": [ + { + "features": [], + "kind": null, + "name": "altdep", + "optional": false, + "registry": "[ROOTURL]/alternative-registry", + "rename": null, + "req": "^0.0.1", + "source": "registry+[ROOTURL]/alternative-registry", + "target": null, + "uses_default_features": true + }, + { + "features": [], + "kind": null, + "name": "iodep", + "optional": false, + "registry": null, + "rename": null, + "req": "^0.0.1", + "source": "registry+https://github.com/rust-lang/crates.io-index", + "target": null, + "uses_default_features": true + } + ], + "description": null, + "documentation": null, + "edition": "2015", + "features": {}, + "homepage": null, + "id": "path+[ROOTURL]/foo#0.0.1", + "keywords": [], + "license": null, + "license_file": null, + "links": null, + "manifest_path": "[ROOT]/foo/Cargo.toml", + "metadata": null, + "name": "foo", + "publish": null, + "readme": null, + "repository": null, + "rust_version": null, + "source": null, + "targets": [ + { + "crate_types": [ + "lib" + ], + "doc": true, + "doctest": true, + "edition": "2015", + "kind": [ + "lib" + ], + "name": "foo", + "src_path": "[ROOT]/foo/src/lib.rs", + "test": true + } + ], + "version": "0.0.1" + }, + { + "authors": [], + "categories": [], + "default_run": null, + "dependencies": [ + { + "features": [], + "kind": null, + "name": "altdep2", + "optional": false, + "registry": "[ROOTURL]/alternative-registry", + "rename": null, + "req": "^0.0.1", + "source": "registry+[ROOTURL]/alternative-registry", + "target": null, + "uses_default_features": true + } + ], + "description": null, + "documentation": null, + "edition": "2015", + "features": {}, + "homepage": null, + "id": "registry+https://github.com/rust-lang/crates.io-index#iodep@0.0.1", + "keywords": [], + "license": null, + "license_file": null, + "links": null, + "manifest_path": "[ROOT]/home/.cargo/registry/src/-[HASH]/iodep-0.0.1/Cargo.toml", + "metadata": null, + "name": "iodep", + "publish": null, + "readme": null, + "repository": null, + "rust_version": null, + "source": "registry+https://github.com/rust-lang/crates.io-index", + "targets": [ + { + "crate_types": [ + "lib" + ], + "doc": true, + "doctest": true, + "edition": "2015", + "kind": [ + "lib" + ], + "name": "iodep", + "src_path": "[ROOT]/home/.cargo/registry/src/-[HASH]/iodep-0.0.1/src/lib.rs", + "test": true + } + ], + "version": "0.0.1" + } + ], + "resolve": { + "nodes": [ + { + "dependencies": [ + "registry+https://github.com/rust-lang/crates.io-index#bar@0.0.1" + ], + "deps": [ + { + "dep_kinds": [ + { + "kind": null, + "target": null + } + ], + "name": "bar", + "pkg": "registry+https://github.com/rust-lang/crates.io-index#bar@0.0.1" + } + ], + "features": [], + "id": "registry+[ROOTURL]/alternative-registry#altdep@0.0.1" + }, + { + "dependencies": [], + "deps": [], + "features": [], + "id": "registry+[ROOTURL]/alternative-registry#altdep2@0.0.1" + }, + { + "dependencies": [], + "deps": [], + "features": [], + "id": "registry+https://github.com/rust-lang/crates.io-index#bar@0.0.1" + }, + { + "dependencies": [ + "registry+[ROOTURL]/alternative-registry#altdep@0.0.1", + "registry+https://github.com/rust-lang/crates.io-index#iodep@0.0.1" + ], + "deps": [ + { + "dep_kinds": [ + { + "kind": null, + "target": null + } + ], + "name": "altdep", + "pkg": "registry+[ROOTURL]/alternative-registry#altdep@0.0.1" + }, + { + "dep_kinds": [ + { + "kind": null, + "target": null + } + ], + "name": "iodep", + "pkg": "registry+https://github.com/rust-lang/crates.io-index#iodep@0.0.1" + } + ], + "features": [], + "id": "path+[ROOTURL]/foo#0.0.1" + }, + { + "dependencies": [ + "registry+[ROOTURL]/alternative-registry#altdep2@0.0.1" + ], + "deps": [ + { + "dep_kinds": [ + { + "kind": null, + "target": null + } + ], + "name": "altdep2", + "pkg": "registry+[ROOTURL]/alternative-registry#altdep2@0.0.1" + } + ], + "features": [], + "id": "registry+https://github.com/rust-lang/crates.io-index#iodep@0.0.1" + } + ], + "root": "path+[ROOTURL]/foo#0.0.1" + }, + "target_directory": "[ROOT]/foo/target", + "version": 1, + "workspace_default_members": [ + "path+[ROOTURL]/foo#0.0.1" + ], + "workspace_members": [ + "path+[ROOTURL]/foo#0.0.1" + ], + "workspace_root": "[ROOT]/foo" +} +"#]] + .json(), ) .run(); } @@ -1193,128 +1399,222 @@ fn unknown_registry() { // foo -> bar registry = null // bar -> baz registry = alternate p.cargo("metadata --format-version=1") - .with_json( - r#" - { - "packages": [ - { - "name": "bar", - "version": "0.0.1", - "id": "registry+https://github.com/rust-lang/crates.io-index#bar@0.0.1", - "license": null, - "license_file": null, - "description": null, - "source": "registry+https://github.com/rust-lang/crates.io-index", - "dependencies": [ - { - "name": "baz", - "source": "registry+file://[..]/alternative-registry", - "req": "^0.0.1", - "kind": null, - "rename": null, - "optional": false, - "uses_default_features": true, - "features": [], - "target": null, - "registry": "file:[..]/alternative-registry" - } - ], - "targets": "{...}", - "features": {}, - "manifest_path": "[..]", - "metadata": null, - "publish": null, - "authors": [], - "categories": [], - "default_run": null, - "keywords": [], - "readme": null, - "repository": null, - "rust_version": null, - "homepage": null, - "documentation": null, - "edition": "2015", - "links": null - }, - { - "name": "baz", - "version": "0.0.1", - "id": "registry+file://[..]/alternative-registry#baz@0.0.1", - "license": null, - "license_file": null, - "description": null, - "source": "registry+file://[..]/alternative-registry", - "dependencies": [], - "targets": "{...}", - "features": {}, - "manifest_path": "[..]", - "metadata": null, - "publish": null, - "authors": [], - "categories": [], - "default_run": null, - "keywords": [], - "readme": null, - "repository": null, - "rust_version": null, - "homepage": null, - "documentation": null, - "edition": "2015", - "links": null - }, - { - "name": "foo", - "version": "0.0.1", - "id": "path+file://[..]/foo#0.0.1", - "license": null, - "license_file": null, - "description": null, - "source": null, - "dependencies": [ - { - "name": "bar", - "source": "registry+https://github.com/rust-lang/crates.io-index", - "req": "^0.0.1", - "kind": null, - "rename": null, - "optional": false, - "uses_default_features": true, - "features": [], - "target": null, - "registry": null - } - ], - "targets": "{...}", - "features": {}, - "manifest_path": "[..]/foo/Cargo.toml", - "metadata": null, - "publish": null, - "authors": [], - "categories": [], - "default_run": null, - "keywords": [], - "readme": null, - "repository": null, - "rust_version": null, - "homepage": null, - "documentation": null, - "edition": "2015", - "links": null - } - ], - "workspace_members": [ - "path+file://[..]/foo#0.0.1" - ], - "workspace_default_members": [ - "path+file://[..]/foo#0.0.1" - ], - "resolve": "{...}", - "target_directory": "[..]/foo/target", - "version": 1, - "workspace_root": "[..]/foo", - "metadata": null - } - "#, + .with_stdout_data( + str![[r#" +{ + "metadata": null, + "packages": [ + { + "authors": [], + "categories": [], + "default_run": null, + "dependencies": [ + { + "features": [], + "kind": null, + "name": "baz", + "optional": false, + "registry": "[ROOTURL]/alternative-registry", + "rename": null, + "req": "^0.0.1", + "source": "registry+[ROOTURL]/alternative-registry", + "target": null, + "uses_default_features": true + } + ], + "description": null, + "documentation": null, + "edition": "2015", + "features": {}, + "homepage": null, + "id": "registry+https://github.com/rust-lang/crates.io-index#bar@0.0.1", + "keywords": [], + "license": null, + "license_file": null, + "links": null, + "manifest_path": "[ROOT]/home/.cargo/registry/src/-[HASH]/bar-0.0.1/Cargo.toml", + "metadata": null, + "name": "bar", + "publish": null, + "readme": null, + "repository": null, + "rust_version": null, + "source": "registry+https://github.com/rust-lang/crates.io-index", + "targets": [ + { + "crate_types": [ + "lib" + ], + "doc": true, + "doctest": true, + "edition": "2015", + "kind": [ + "lib" + ], + "name": "bar", + "src_path": "[ROOT]/home/.cargo/registry/src/-[HASH]/bar-0.0.1/src/lib.rs", + "test": true + } + ], + "version": "0.0.1" + }, + { + "authors": [], + "categories": [], + "default_run": null, + "dependencies": [], + "description": null, + "documentation": null, + "edition": "2015", + "features": {}, + "homepage": null, + "id": "registry+[ROOTURL]/alternative-registry#baz@0.0.1", + "keywords": [], + "license": null, + "license_file": null, + "links": null, + "manifest_path": "[ROOT]/home/.cargo/registry/src/-[HASH]/baz-0.0.1/Cargo.toml", + "metadata": null, + "name": "baz", + "publish": null, + "readme": null, + "repository": null, + "rust_version": null, + "source": "registry+[ROOTURL]/alternative-registry", + "targets": [ + { + "crate_types": [ + "lib" + ], + "doc": true, + "doctest": true, + "edition": "2015", + "kind": [ + "lib" + ], + "name": "baz", + "src_path": "[ROOT]/home/.cargo/registry/src/-[HASH]/baz-0.0.1/src/lib.rs", + "test": true + } + ], + "version": "0.0.1" + }, + { + "authors": [], + "categories": [], + "default_run": null, + "dependencies": [ + { + "features": [], + "kind": null, + "name": "bar", + "optional": false, + "registry": null, + "rename": null, + "req": "^0.0.1", + "source": "registry+https://github.com/rust-lang/crates.io-index", + "target": null, + "uses_default_features": true + } + ], + "description": null, + "documentation": null, + "edition": "2015", + "features": {}, + "homepage": null, + "id": "path+[ROOTURL]/foo#0.0.1", + "keywords": [], + "license": null, + "license_file": null, + "links": null, + "manifest_path": "[ROOT]/foo/Cargo.toml", + "metadata": null, + "name": "foo", + "publish": null, + "readme": null, + "repository": null, + "rust_version": null, + "source": null, + "targets": [ + { + "crate_types": [ + "bin" + ], + "doc": true, + "doctest": false, + "edition": "2015", + "kind": [ + "bin" + ], + "name": "foo", + "src_path": "[ROOT]/foo/src/main.rs", + "test": true + } + ], + "version": "0.0.1" + } + ], + "resolve": { + "nodes": [ + { + "dependencies": [ + "registry+[ROOTURL]/alternative-registry#baz@0.0.1" + ], + "deps": [ + { + "dep_kinds": [ + { + "kind": null, + "target": null + } + ], + "name": "baz", + "pkg": "registry+[ROOTURL]/alternative-registry#baz@0.0.1" + } + ], + "features": [], + "id": "registry+https://github.com/rust-lang/crates.io-index#bar@0.0.1" + }, + { + "dependencies": [], + "deps": [], + "features": [], + "id": "registry+[ROOTURL]/alternative-registry#baz@0.0.1" + }, + { + "dependencies": [ + "registry+https://github.com/rust-lang/crates.io-index#bar@0.0.1" + ], + "deps": [ + { + "dep_kinds": [ + { + "kind": null, + "target": null + } + ], + "name": "bar", + "pkg": "registry+https://github.com/rust-lang/crates.io-index#bar@0.0.1" + } + ], + "features": [], + "id": "path+[ROOTURL]/foo#0.0.1" + } + ], + "root": "path+[ROOTURL]/foo#0.0.1" + }, + "target_directory": "[ROOT]/foo/target", + "version": 1, + "workspace_default_members": [ + "path+[ROOTURL]/foo#0.0.1" + ], + "workspace_members": [ + "path+[ROOTURL]/foo#0.0.1" + ], + "workspace_root": "[ROOT]/foo" +} +"#]] + .json(), ) .run(); } @@ -1354,17 +1654,16 @@ fn registries_index_relative_url() { Package::new("bar", "0.0.1").alternative(true).publish(); p.cargo("check") - .with_stderr( - "\ + .with_stderr_data(str![[r#" [UPDATING] `relative` index [LOCKING] 2 packages to latest compatible versions [DOWNLOADING] crates ... [DOWNLOADED] bar v0.0.1 (registry `relative`) [CHECKING] bar v0.0.1 (registry `relative`) -[CHECKING] foo v0.0.1 ([CWD]) -[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]s -", - ) +[CHECKING] foo v0.0.1 ([ROOT]/foo) +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]) .run(); } @@ -1403,18 +1702,16 @@ fn registries_index_relative_path_not_allowed() { Package::new("bar", "0.0.1").alternative(true).publish(); p.cargo("check") - .with_stderr(&format!( - "\ -error: failed to parse manifest at `{root}/foo/Cargo.toml` + .with_stderr_data(str![[r#" +[ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml` Caused by: - invalid index URL for registry `relative` defined in [..]/.cargo/config.toml + invalid index URL for registry `relative` defined in [ROOT]/.cargo/config.toml Caused by: invalid url `alternative-registry`: relative URL without a base -", - root = paths::root().to_str().unwrap() - )) + +"#]]) .with_status(101) .run(); } @@ -1427,9 +1724,14 @@ fn both_index_and_registry() { .arg("--registry=foo") .arg("--index=foo") .with_status(1) - .with_stderr_contains( - "error: the argument '--registry ' cannot be used with '--index '", - ) + .with_stderr_data(str![[r#" +[ERROR] the argument '--registry ' cannot be used with '--index ' + +Usage: [..] + +For more information, try '--help'. + +"#]]) .run(); } } @@ -1448,7 +1750,10 @@ fn both_index_and_default() { .env("CARGO_REGISTRY_DEFAULT", "undefined") .arg(format!("--index=index_url")) .with_status(101) - .with_stderr("[ERROR] invalid url `index_url`: relative URL without a base") + .with_stderr_data(str![[r#" +[ERROR] invalid url `index_url`: relative URL without a base + +"#]]) .run(); } } @@ -1569,13 +1874,13 @@ fn warn_for_unused_fields() { p.cargo("publish --registry alternative") .with_status(101) - .with_stderr( - "\ + .with_stderr_data(str![[r#" [UPDATING] `alternative` index -[WARNING] unused config key `registries.alternative.unexpected-field` in `[..]config.toml` +[WARNING] unused config key `registries.alternative.unexpected-field` in `[ROOT]/foo/.cargo/config.toml` [ERROR] no token found for `alternative`, please run `cargo login --registry alternative` -or use environment variable CARGO_REGISTRIES_ALTERNATIVE_TOKEN", - ) +or use environment variable CARGO_REGISTRIES_ALTERNATIVE_TOKEN + +"#]]) .run(); let crates_io = registry::RegistryBuilder::new() @@ -1584,13 +1889,13 @@ or use environment variable CARGO_REGISTRIES_ALTERNATIVE_TOKEN", p.cargo("publish --registry crates-io") .replace_crates_io(crates_io.index_url()) .with_status(101) - .with_stderr( - "\ + .with_stderr_data(str![[r#" [UPDATING] crates.io index -[WARNING] unused config key `registry.unexpected-field` in `[..]config.toml` +[WARNING] unused config key `registry.unexpected-field` in `[ROOT]/foo/.cargo/config.toml` [ERROR] no token found, please run `cargo login` -or use environment variable CARGO_REGISTRY_TOKEN", - ) +or use environment variable CARGO_REGISTRY_TOKEN + +"#]]) .run(); } @@ -1613,10 +1918,10 @@ fn config_empty_registry_name() { .arg("--registry") .arg("") .with_status(101) - .with_stderr( - "\ -[ERROR] registry name cannot be empty", - ) + .with_stderr_data(str![[r#" +[ERROR] registry name cannot be empty + +"#]]) .run(); } @@ -1628,10 +1933,10 @@ fn empty_registry_flag() { .arg("--registry") .arg("") .with_status(101) - .with_stderr( - "\ -[ERROR] registry name cannot be empty", - ) + .with_stderr_data(str![[r#" +[ERROR] registry name cannot be empty + +"#]]) .run(); } @@ -1661,17 +1966,16 @@ fn empty_dependency_registry() { p.cargo("check") .with_status(101) - .with_stderr( - "\ + .with_stderr_data(str![[r#" [ERROR] registry name cannot be empty --> Cargo.toml:8:23 | -8 | bar = { version = \"0.1.0\", registry = \"\" } +8 | bar = { version = "0.1.0", registry = "" } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -", - ) + +"#]]) .run(); }