mirror of
https://github.com/rust-lang/cargo.git
synced 2025-10-01 11:30:39 +00:00
Auto merge of #14031 - epage:snap, r=weihanglo
tests: Migrate alt_registry to snapbox ### What does this PR try to resolve? The overall goal is to enable the use of snapshot testing on as many cargo tests as possible to reduce the burden when having to touch a lot of tests. Towards that aim, this PR - Adds snapshot testing to `cargo_test_support::Execs` - Migrates `alt_registry` tests over as an example (and to vet it) I've taken the approach of deprecating all other output assertions on `Execs` with `#[allow(deprecated)]` in every test file. This let's us easily identity what files haven't been migrated, what in a file needs migration, and helps prevent a file from regressing. This should make it easier to do a gradual migration that (as many people as they want) can chip in. It comes at the cost of losing visibility into deprecated items we use. Hopefully we won't be in this intermediate state for too long. To reduce manual touch ups of snapshots, I've added some regex redactions. My main concern with the `FILE_SIZE` redaction was when we test for specific sizes. That shouldn't be a problem because we don't use `Execs::with_stderr` to test those but we capture the output and have a custom asserter for it. ### How should we test and review this PR? Yes, this puts us in an intermediate state which isn't ideal but much better than one person trying to do all of this in a single branch / PR. The main risk is that we'll hit a snag with snapbox being able to support our needs. We got away with a lot because everything was custom, down to the diffing algorithm. This is why I at least started with `alt_registry` to get a feel for what problems we might have. There will likely be some we uncover. I'm fairly confident that we can resolve them in some way, ### Additional information This is a continuation of the work done in #13980.
This commit is contained in:
commit
a9ee3e82b5
3
Cargo.lock
generated
3
Cargo.lock
generated
@ -413,7 +413,7 @@ version = "0.2.1"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cargo-test-support"
|
name = "cargo-test-support"
|
||||||
version = "0.2.1"
|
version = "0.2.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anstream",
|
"anstream",
|
||||||
"anstyle",
|
"anstyle",
|
||||||
@ -3230,6 +3230,7 @@ dependencies = [
|
|||||||
"filetime",
|
"filetime",
|
||||||
"normalize-line-endings",
|
"normalize-line-endings",
|
||||||
"regex",
|
"regex",
|
||||||
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"similar",
|
"similar",
|
||||||
"snapbox-macros",
|
"snapbox-macros",
|
||||||
|
@ -91,7 +91,7 @@ sha1 = "0.10.6"
|
|||||||
sha2 = "0.10.8"
|
sha2 = "0.10.8"
|
||||||
shell-escape = "0.1.5"
|
shell-escape = "0.1.5"
|
||||||
supports-hyperlinks = "3.0.0"
|
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", "json"] }
|
||||||
tar = { version = "0.4.40", default-features = false }
|
tar = { version = "0.4.40", default-features = false }
|
||||||
tempfile = "3.10.1"
|
tempfile = "3.10.1"
|
||||||
thiserror = "1.0.59"
|
thiserror = "1.0.59"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "cargo-test-support"
|
name = "cargo-test-support"
|
||||||
version = "0.2.1"
|
version = "0.2.2"
|
||||||
edition.workspace = true
|
edition.workspace = true
|
||||||
rust-version = "1.78" # MSRV:1
|
rust-version = "1.78" # MSRV:1
|
||||||
license.workspace = true
|
license.workspace = true
|
||||||
|
@ -92,6 +92,16 @@ pub fn assert_ui() -> snapbox::Assert {
|
|||||||
regex::Regex::new("Finished.*in (?<redacted>[0-9]+(\\.[0-9]+))s").unwrap(),
|
regex::Regex::new("Finished.*in (?<redacted>[0-9]+(\\.[0-9]+))s").unwrap(),
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
subs.insert(
|
||||||
|
"[FILE_SIZE]",
|
||||||
|
regex::Regex::new("(?<redacted>[0-9]+(\\.[0-9]+)([a-zA-Z]i)?)B").unwrap(),
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
subs.insert(
|
||||||
|
"[HASH]",
|
||||||
|
regex::Regex::new("home/\\.cargo/registry/src/-(?<redacted>[a-z0-9]+)").unwrap(),
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
snapbox::Assert::new()
|
snapbox::Assert::new()
|
||||||
.action_env(snapbox::assert::DEFAULT_ACTION_ENV)
|
.action_env(snapbox::assert::DEFAULT_ACTION_ENV)
|
||||||
.redact_with(subs)
|
.redact_with(subs)
|
||||||
@ -146,6 +156,16 @@ pub fn assert_e2e() -> snapbox::Assert {
|
|||||||
regex::Regex::new("[FINISHED].*in (?<redacted>[0-9]+(\\.[0-9]+))s").unwrap(),
|
regex::Regex::new("[FINISHED].*in (?<redacted>[0-9]+(\\.[0-9]+))s").unwrap(),
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
subs.insert(
|
||||||
|
"[FILE_SIZE]",
|
||||||
|
regex::Regex::new("(?<redacted>[0-9]+(\\.[0-9]+)([a-zA-Z]i)?)B").unwrap(),
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
subs.insert(
|
||||||
|
"[HASH]",
|
||||||
|
regex::Regex::new("home/\\.cargo/registry/src/-(?<redacted>[a-z0-9]+)").unwrap(),
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
snapbox::Assert::new()
|
snapbox::Assert::new()
|
||||||
.action_env(snapbox::assert::DEFAULT_ACTION_ENV)
|
.action_env(snapbox::assert::DEFAULT_ACTION_ENV)
|
||||||
.redact_with(subs)
|
.redact_with(subs)
|
||||||
|
@ -25,6 +25,7 @@ use std::time::{self, Duration};
|
|||||||
|
|
||||||
use anyhow::{bail, Result};
|
use anyhow::{bail, Result};
|
||||||
use cargo_util::{is_ci, ProcessBuilder, ProcessError};
|
use cargo_util::{is_ci, ProcessBuilder, ProcessError};
|
||||||
|
use snapbox::IntoData as _;
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
use self::paths::CargoPathExt;
|
use self::paths::CargoPathExt;
|
||||||
@ -534,6 +535,8 @@ pub struct Execs {
|
|||||||
expect_stdin: Option<String>,
|
expect_stdin: Option<String>,
|
||||||
expect_stderr: Option<String>,
|
expect_stderr: Option<String>,
|
||||||
expect_exit_code: Option<i32>,
|
expect_exit_code: Option<i32>,
|
||||||
|
expect_stdout_data: Option<snapbox::Data>,
|
||||||
|
expect_stderr_data: Option<snapbox::Data>,
|
||||||
expect_stdout_contains: Vec<String>,
|
expect_stdout_contains: Vec<String>,
|
||||||
expect_stderr_contains: Vec<String>,
|
expect_stderr_contains: Vec<String>,
|
||||||
expect_stdout_contains_n: Vec<(String, usize)>,
|
expect_stdout_contains_n: Vec<(String, usize)>,
|
||||||
@ -545,6 +548,7 @@ pub struct Execs {
|
|||||||
expect_json: Option<String>,
|
expect_json: Option<String>,
|
||||||
expect_json_contains_unordered: Option<String>,
|
expect_json_contains_unordered: Option<String>,
|
||||||
stream_output: bool,
|
stream_output: bool,
|
||||||
|
assert: snapbox::Assert,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Execs {
|
impl Execs {
|
||||||
@ -555,6 +559,7 @@ impl Execs {
|
|||||||
|
|
||||||
/// Verifies that stdout is equal to the given lines.
|
/// Verifies that stdout is equal to the given lines.
|
||||||
/// See [`compare`] for supported patterns.
|
/// See [`compare`] for supported patterns.
|
||||||
|
#[deprecated(note = "replaced with `Execs::with_stdout_data(expected)`")]
|
||||||
pub fn with_stdout<S: ToString>(&mut self, expected: S) -> &mut Self {
|
pub fn with_stdout<S: ToString>(&mut self, expected: S) -> &mut Self {
|
||||||
self.expect_stdout = Some(expected.to_string());
|
self.expect_stdout = Some(expected.to_string());
|
||||||
self
|
self
|
||||||
@ -562,11 +567,28 @@ impl Execs {
|
|||||||
|
|
||||||
/// Verifies that stderr is equal to the given lines.
|
/// Verifies that stderr is equal to the given lines.
|
||||||
/// See [`compare`] for supported patterns.
|
/// See [`compare`] for supported patterns.
|
||||||
|
#[deprecated(note = "replaced with `Execs::with_stderr_data(expected)`")]
|
||||||
pub fn with_stderr<S: ToString>(&mut self, expected: S) -> &mut Self {
|
pub fn with_stderr<S: ToString>(&mut self, expected: S) -> &mut Self {
|
||||||
self.expect_stderr = Some(expected.to_string());
|
self.expect_stderr = Some(expected.to_string());
|
||||||
self
|
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.
|
/// Writes the given lines to stdin.
|
||||||
pub fn with_stdin<S: ToString>(&mut self, expected: S) -> &mut Self {
|
pub fn with_stdin<S: ToString>(&mut self, expected: S) -> &mut Self {
|
||||||
self.expect_stdin = Some(expected.to_string());
|
self.expect_stdin = Some(expected.to_string());
|
||||||
@ -593,6 +615,7 @@ impl Execs {
|
|||||||
/// its output.
|
/// its output.
|
||||||
///
|
///
|
||||||
/// See [`compare`] for supported patterns.
|
/// See [`compare`] for supported patterns.
|
||||||
|
#[deprecated(note = "replaced with `Execs::with_stdout_data(expected)`")]
|
||||||
pub fn with_stdout_contains<S: ToString>(&mut self, expected: S) -> &mut Self {
|
pub fn with_stdout_contains<S: ToString>(&mut self, expected: S) -> &mut Self {
|
||||||
self.expect_stdout_contains.push(expected.to_string());
|
self.expect_stdout_contains.push(expected.to_string());
|
||||||
self
|
self
|
||||||
@ -602,6 +625,7 @@ impl Execs {
|
|||||||
/// its output.
|
/// its output.
|
||||||
///
|
///
|
||||||
/// See [`compare`] for supported patterns.
|
/// See [`compare`] for supported patterns.
|
||||||
|
#[deprecated(note = "replaced with `Execs::with_stderr_data(expected)`")]
|
||||||
pub fn with_stderr_contains<S: ToString>(&mut self, expected: S) -> &mut Self {
|
pub fn with_stderr_contains<S: ToString>(&mut self, expected: S) -> &mut Self {
|
||||||
self.expect_stderr_contains.push(expected.to_string());
|
self.expect_stderr_contains.push(expected.to_string());
|
||||||
self
|
self
|
||||||
@ -611,6 +635,7 @@ impl Execs {
|
|||||||
/// its output, and should be repeated `number` times.
|
/// its output, and should be repeated `number` times.
|
||||||
///
|
///
|
||||||
/// See [`compare`] for supported patterns.
|
/// See [`compare`] for supported patterns.
|
||||||
|
#[deprecated(note = "replaced with `Execs::with_stdout_data(expected)`")]
|
||||||
pub fn with_stdout_contains_n<S: ToString>(&mut self, expected: S, number: usize) -> &mut Self {
|
pub fn with_stdout_contains_n<S: ToString>(&mut self, expected: S, number: usize) -> &mut Self {
|
||||||
self.expect_stdout_contains_n
|
self.expect_stdout_contains_n
|
||||||
.push((expected.to_string(), number));
|
.push((expected.to_string(), number));
|
||||||
@ -622,6 +647,7 @@ impl Execs {
|
|||||||
/// See [`compare`] for supported patterns.
|
/// See [`compare`] for supported patterns.
|
||||||
///
|
///
|
||||||
/// See note on [`Self::with_stderr_does_not_contain`].
|
/// See note on [`Self::with_stderr_does_not_contain`].
|
||||||
|
#[deprecated]
|
||||||
pub fn with_stdout_does_not_contain<S: ToString>(&mut self, expected: S) -> &mut Self {
|
pub fn with_stdout_does_not_contain<S: ToString>(&mut self, expected: S) -> &mut Self {
|
||||||
self.expect_stdout_not_contains.push(expected.to_string());
|
self.expect_stdout_not_contains.push(expected.to_string());
|
||||||
self
|
self
|
||||||
@ -636,6 +662,7 @@ impl Execs {
|
|||||||
/// your test will pass without verifying the correct behavior. If
|
/// your test will pass without verifying the correct behavior. If
|
||||||
/// possible, write the test first so that it fails, and then implement
|
/// possible, write the test first so that it fails, and then implement
|
||||||
/// your fix/feature to make it pass.
|
/// your fix/feature to make it pass.
|
||||||
|
#[deprecated]
|
||||||
pub fn with_stderr_does_not_contain<S: ToString>(&mut self, expected: S) -> &mut Self {
|
pub fn with_stderr_does_not_contain<S: ToString>(&mut self, expected: S) -> &mut Self {
|
||||||
self.expect_stderr_not_contains.push(expected.to_string());
|
self.expect_stderr_not_contains.push(expected.to_string());
|
||||||
self
|
self
|
||||||
@ -645,6 +672,7 @@ impl Execs {
|
|||||||
/// ignoring the order of the lines.
|
/// ignoring the order of the lines.
|
||||||
///
|
///
|
||||||
/// See [`Execs::with_stderr_unordered`] for more details.
|
/// See [`Execs::with_stderr_unordered`] for more details.
|
||||||
|
#[deprecated(note = "replaced with `Execs::with_stdout_data(expected.unordered())`")]
|
||||||
pub fn with_stdout_unordered<S: ToString>(&mut self, expected: S) -> &mut Self {
|
pub fn with_stdout_unordered<S: ToString>(&mut self, expected: S) -> &mut Self {
|
||||||
self.expect_stdout_unordered.push(expected.to_string());
|
self.expect_stdout_unordered.push(expected.to_string());
|
||||||
self
|
self
|
||||||
@ -671,6 +699,7 @@ impl Execs {
|
|||||||
///
|
///
|
||||||
/// This will randomly fail if the other crate name is `bar`, and the
|
/// This will randomly fail if the other crate name is `bar`, and the
|
||||||
/// order changes.
|
/// order changes.
|
||||||
|
#[deprecated(note = "replaced with `Execs::with_stderr_data(expected.unordered())`")]
|
||||||
pub fn with_stderr_unordered<S: ToString>(&mut self, expected: S) -> &mut Self {
|
pub fn with_stderr_unordered<S: ToString>(&mut self, expected: S) -> &mut Self {
|
||||||
self.expect_stderr_unordered.push(expected.to_string());
|
self.expect_stderr_unordered.push(expected.to_string());
|
||||||
self
|
self
|
||||||
@ -698,6 +727,7 @@ impl Execs {
|
|||||||
///
|
///
|
||||||
/// Be careful writing the `without` fragments, see note in
|
/// Be careful writing the `without` fragments, see note in
|
||||||
/// `with_stderr_does_not_contain`.
|
/// `with_stderr_does_not_contain`.
|
||||||
|
#[deprecated]
|
||||||
pub fn with_stderr_line_without<S: ToString>(
|
pub fn with_stderr_line_without<S: ToString>(
|
||||||
&mut self,
|
&mut self,
|
||||||
with: &[S],
|
with: &[S],
|
||||||
@ -730,6 +760,7 @@ impl Execs {
|
|||||||
/// - The order of arrays is ignored.
|
/// - The order of arrays is ignored.
|
||||||
/// - Strings support patterns described in [`compare`].
|
/// - Strings support patterns described in [`compare`].
|
||||||
/// - Use `"{...}"` to match any object.
|
/// - 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 {
|
pub fn with_json(&mut self, expected: &str) -> &mut Self {
|
||||||
self.expect_json = Some(expected.to_string());
|
self.expect_json = Some(expected.to_string());
|
||||||
self
|
self
|
||||||
@ -744,6 +775,7 @@ impl Execs {
|
|||||||
/// what you are doing.
|
/// what you are doing.
|
||||||
///
|
///
|
||||||
/// See `with_json` for more detail.
|
/// See `with_json` for more detail.
|
||||||
|
#[deprecated]
|
||||||
pub fn with_json_contains_unordered(&mut self, expected: &str) -> &mut Self {
|
pub fn with_json_contains_unordered(&mut self, expected: &str) -> &mut Self {
|
||||||
match &mut self.expect_json_contains_unordered {
|
match &mut self.expect_json_contains_unordered {
|
||||||
None => self.expect_json_contains_unordered = Some(expected.to_string()),
|
None => self.expect_json_contains_unordered = Some(expected.to_string()),
|
||||||
@ -908,11 +940,14 @@ impl Execs {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[track_caller]
|
||||||
fn verify_checks_output(&self, stdout: &[u8], stderr: &[u8]) {
|
fn verify_checks_output(&self, stdout: &[u8], stderr: &[u8]) {
|
||||||
if self.expect_exit_code.unwrap_or(0) != 0
|
if self.expect_exit_code.unwrap_or(0) != 0
|
||||||
&& self.expect_stdout.is_none()
|
&& self.expect_stdout.is_none()
|
||||||
&& self.expect_stdin.is_none()
|
&& self.expect_stdin.is_none()
|
||||||
&& self.expect_stderr.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_stdout_contains.is_empty()
|
||||||
&& self.expect_stderr_contains.is_empty()
|
&& self.expect_stderr_contains.is_empty()
|
||||||
&& self.expect_stdout_contains_n.is_empty()
|
&& self.expect_stdout_contains_n.is_empty()
|
||||||
@ -934,6 +969,7 @@ impl Execs {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[track_caller]
|
||||||
fn match_process(&self, process: &ProcessBuilder) -> Result<RawOutput> {
|
fn match_process(&self, process: &ProcessBuilder) -> Result<RawOutput> {
|
||||||
println!("running {}", process);
|
println!("running {}", process);
|
||||||
let res = if self.stream_output {
|
let res = if self.stream_output {
|
||||||
@ -984,6 +1020,7 @@ impl Execs {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[track_caller]
|
||||||
fn match_output(&self, code: Option<i32>, stdout: &[u8], stderr: &[u8]) -> Result<()> {
|
fn match_output(&self, code: Option<i32>, stdout: &[u8], stderr: &[u8]) -> Result<()> {
|
||||||
self.verify_checks_output(stdout, stderr);
|
self.verify_checks_output(stdout, stderr);
|
||||||
let stdout = std::str::from_utf8(stdout).expect("stdout is not utf8");
|
let stdout = std::str::from_utf8(stdout).expect("stdout is not utf8");
|
||||||
@ -1008,6 +1045,24 @@ impl Execs {
|
|||||||
if let Some(expect_stderr) = &self.expect_stderr {
|
if let Some(expect_stderr) = &self.expect_stderr {
|
||||||
compare::match_exact(expect_stderr, stderr, "stderr", stdout, cwd)?;
|
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() {
|
for expect in self.expect_stdout_contains.iter() {
|
||||||
compare::match_contains(expect, stdout, cwd)?;
|
compare::match_contains(expect, stdout, cwd)?;
|
||||||
}
|
}
|
||||||
@ -1060,6 +1115,8 @@ pub fn execs() -> Execs {
|
|||||||
expect_stderr: None,
|
expect_stderr: None,
|
||||||
expect_stdin: None,
|
expect_stdin: None,
|
||||||
expect_exit_code: Some(0),
|
expect_exit_code: Some(0),
|
||||||
|
expect_stdout_data: None,
|
||||||
|
expect_stderr_data: None,
|
||||||
expect_stdout_contains: Vec::new(),
|
expect_stdout_contains: Vec::new(),
|
||||||
expect_stderr_contains: Vec::new(),
|
expect_stderr_contains: Vec::new(),
|
||||||
expect_stdout_contains_n: Vec::new(),
|
expect_stdout_contains_n: Vec::new(),
|
||||||
@ -1071,6 +1128,7 @@ pub fn execs() -> Execs {
|
|||||||
expect_json: None,
|
expect_json: None,
|
||||||
expect_json_contains_unordered: None,
|
expect_json_contains_unordered: None,
|
||||||
stream_output: false,
|
stream_output: false,
|
||||||
|
assert: compare::assert_e2e(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
//! Otherwise the tests are skipped.
|
//! Otherwise the tests are skipped.
|
||||||
|
|
||||||
#![allow(clippy::disallowed_methods)]
|
#![allow(clippy::disallowed_methods)]
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo_test_support::*;
|
use cargo_test_support::*;
|
||||||
use std::env;
|
use std::env;
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,8 @@
|
|||||||
//! Tests specific to artifact dependencies, designated using
|
//! Tests specific to artifact dependencies, designated using
|
||||||
//! the new `dep = { artifact = "bin", … }` syntax in manifests.
|
//! the new `dep = { artifact = "bin", … }` syntax in manifests.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo_test_support::compare::assert_e2e;
|
use cargo_test_support::compare::assert_e2e;
|
||||||
use cargo_test_support::registry::{Package, RegistryBuilder};
|
use cargo_test_support::registry::{Package, RegistryBuilder};
|
||||||
use cargo_test_support::str;
|
use cargo_test_support::str;
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for --artifact-dir flag.
|
//! Tests for --artifact-dir flag.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo_test_support::sleep_ms;
|
use cargo_test_support::sleep_ms;
|
||||||
use cargo_test_support::{basic_manifest, project};
|
use cargo_test_support::{basic_manifest, project};
|
||||||
use std::env;
|
use std::env;
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for some invalid .cargo/config files.
|
//! Tests for some invalid .cargo/config files.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo_test_support::git::cargo_uses_gitoxide;
|
use cargo_test_support::git::cargo_uses_gitoxide;
|
||||||
use cargo_test_support::registry::{self, Package};
|
use cargo_test_support::registry::{self, Package};
|
||||||
use cargo_test_support::{basic_manifest, project, rustc_host};
|
use cargo_test_support::{basic_manifest, project, rustc_host};
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for invalid --manifest-path arguments.
|
//! Tests for invalid --manifest-path arguments.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo_test_support::{basic_bin_manifest, main_file, project};
|
use cargo_test_support::{basic_bin_manifest, main_file, project};
|
||||||
|
|
||||||
#[track_caller]
|
#[track_caller]
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for the `cargo bench` command.
|
//! Tests for the `cargo bench` command.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo_test_support::paths::CargoPathExt;
|
use cargo_test_support::paths::CargoPathExt;
|
||||||
use cargo_test_support::{basic_bin_manifest, basic_lib_manifest, basic_manifest, project};
|
use cargo_test_support::{basic_bin_manifest, basic_lib_manifest, basic_manifest, project};
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo_test_support::install::{
|
use cargo_test_support::install::{
|
||||||
assert_has_installed_exe, assert_has_not_installed_exe, cargo_home,
|
assert_has_installed_exe, assert_has_not_installed_exe, cargo_home,
|
||||||
};
|
};
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for the `cargo build` command.
|
//! Tests for the `cargo build` command.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo::{
|
use cargo::{
|
||||||
core::compiler::CompileMode,
|
core::compiler::CompileMode,
|
||||||
core::{Shell, Workspace},
|
core::{Shell, Workspace},
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for --build-plan feature.
|
//! Tests for --build-plan feature.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo_test_support::registry::Package;
|
use cargo_test_support::registry::Package;
|
||||||
use cargo_test_support::{basic_bin_manifest, basic_manifest, main_file, project};
|
use cargo_test_support::{basic_bin_manifest, basic_manifest, main_file, project};
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for build.rs scripts.
|
//! Tests for build.rs scripts.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo_test_support::compare::assert_e2e;
|
use cargo_test_support::compare::assert_e2e;
|
||||||
use cargo_test_support::install::cargo_home;
|
use cargo_test_support::install::cargo_home;
|
||||||
use cargo_test_support::paths::CargoPathExt;
|
use cargo_test_support::paths::CargoPathExt;
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for build.rs rerun-if-env-changed and rustc-env
|
//! Tests for build.rs rerun-if-env-changed and rustc-env
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo_test_support::basic_manifest;
|
use cargo_test_support::basic_manifest;
|
||||||
use cargo_test_support::project;
|
use cargo_test_support::project;
|
||||||
use cargo_test_support::sleep_ms;
|
use cargo_test_support::sleep_ms;
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
// because MSVC link.exe just gives a warning on unknown flags (how helpful!),
|
// because MSVC link.exe just gives a warning on unknown flags (how helpful!),
|
||||||
// and other linkers will return an error.
|
// and other linkers will return an error.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo_test_support::registry::Package;
|
use cargo_test_support::registry::Package;
|
||||||
use cargo_test_support::{basic_bin_manifest, basic_lib_manifest, basic_manifest, project};
|
use cargo_test_support::{basic_bin_manifest, basic_lib_manifest, basic_manifest, project};
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for `CacheLock`.
|
//! Tests for `CacheLock`.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use crate::config::GlobalContextBuilder;
|
use crate::config::GlobalContextBuilder;
|
||||||
use cargo::util::cache_lock::{CacheLockMode, CacheLocker};
|
use cargo::util::cache_lock::{CacheLockMode, CacheLocker};
|
||||||
use cargo_test_support::paths::{self, CargoPathExt};
|
use cargo_test_support::paths::{self, CargoPathExt};
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for caching compiler diagnostics.
|
//! Tests for caching compiler diagnostics.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use super::messages::raw_rustc_output;
|
use super::messages::raw_rustc_output;
|
||||||
use cargo_test_support::tools;
|
use cargo_test_support::tools;
|
||||||
use cargo_test_support::{basic_manifest, is_coarse_mtime, project, registry::Package, sleep_ms};
|
use cargo_test_support::{basic_manifest, is_coarse_mtime, project, registry::Package, sleep_ms};
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for `[alias]` config command aliases.
|
//! Tests for `[alias]` config command aliases.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use std::env;
|
use std::env;
|
||||||
|
|
||||||
use cargo_test_support::tools::echo_subcommand;
|
use cargo_test_support::tools::echo_subcommand;
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for custom cargo commands and other global command features.
|
//! Tests for custom cargo commands and other global command features.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::io::Read;
|
use std::io::Read;
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for the `cargo config` command.
|
//! Tests for the `cargo config` command.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use super::config::write_config_at;
|
use super::config::write_config_at;
|
||||||
use cargo_test_support::paths;
|
use cargo_test_support::paths;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for `[env]` config.
|
//! Tests for `[env]` config.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo_test_support::basic_manifest;
|
use cargo_test_support::basic_manifest;
|
||||||
use cargo_test_support::{basic_bin_manifest, project};
|
use cargo_test_support::{basic_bin_manifest, project};
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for `cargo-features` definitions.
|
//! Tests for `cargo-features` definitions.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo_test_support::registry::Package;
|
use cargo_test_support::registry::Package;
|
||||||
use cargo_test_support::{project, registry};
|
use cargo_test_support::{project, registry};
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests specifically related to target handling (lib, bins, examples, tests, benches).
|
//! Tests specifically related to target handling (lib, bins, examples, tests, benches).
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo_test_support::project;
|
use cargo_test_support::project;
|
||||||
|
|
||||||
#[cargo_test]
|
#[cargo_test]
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for cfg() expressions.
|
//! Tests for cfg() expressions.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo_test_support::registry::Package;
|
use cargo_test_support::registry::Package;
|
||||||
use cargo_test_support::rustc_host;
|
use cargo_test_support::rustc_host;
|
||||||
use cargo_test_support::{basic_manifest, project};
|
use cargo_test_support::{basic_manifest, project};
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for the `cargo check` command.
|
//! Tests for the `cargo check` command.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use std::fmt::{self, Write};
|
use std::fmt::{self, Write};
|
||||||
|
|
||||||
use crate::messages::raw_rustc_output;
|
use crate::messages::raw_rustc_output;
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for Cargo usage of rustc `--check-cfg`.
|
//! Tests for Cargo usage of rustc `--check-cfg`.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo_test_support::{basic_manifest, project};
|
use cargo_test_support::{basic_manifest, project};
|
||||||
|
|
||||||
macro_rules! x {
|
macro_rules! x {
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for the `cargo clean` command.
|
//! Tests for the `cargo clean` command.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo_test_support::paths::CargoPathExt;
|
use cargo_test_support::paths::CargoPathExt;
|
||||||
use cargo_test_support::registry::Package;
|
use cargo_test_support::registry::Package;
|
||||||
use cargo_test_support::{
|
use cargo_test_support::{
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
//! Ideally these should never happen, but I don't think we'll ever be able to
|
//! Ideally these should never happen, but I don't think we'll ever be able to
|
||||||
//! prevent all collisions.
|
//! prevent all collisions.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo_test_support::registry::Package;
|
use cargo_test_support::registry::Package;
|
||||||
use cargo_test_support::{basic_manifest, cross_compile, project};
|
use cargo_test_support::{basic_manifest, cross_compile, project};
|
||||||
use std::env;
|
use std::env;
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for running multiple `cargo` processes at the same time.
|
//! Tests for running multiple `cargo` processes at the same time.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::net::TcpListener;
|
use std::net::TcpListener;
|
||||||
use std::process::Stdio;
|
use std::process::Stdio;
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for config settings.
|
//! Tests for config settings.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo::core::features::{GitFeatures, GitoxideFeatures};
|
use cargo::core::features::{GitFeatures, GitoxideFeatures};
|
||||||
use cargo::core::{PackageIdSpec, Shell};
|
use cargo::core::{PackageIdSpec, Shell};
|
||||||
use cargo::util::context::{
|
use cargo::util::context::{
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for the --config CLI option.
|
//! Tests for the --config CLI option.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use super::config::{
|
use super::config::{
|
||||||
assert_error, read_output, write_config_at, write_config_toml, GlobalContextBuilder,
|
assert_error, read_output, write_config_at, write_config_toml, GlobalContextBuilder,
|
||||||
};
|
};
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for `include` config field.
|
//! Tests for `include` config field.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use super::config::{assert_error, write_config_at, write_config_toml, GlobalContextBuilder};
|
use super::config::{assert_error, write_config_at, write_config_toml, GlobalContextBuilder};
|
||||||
use cargo_test_support::{no_such_file_err_msg, project};
|
use cargo_test_support::{no_such_file_err_msg, project};
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for corrupt git repos.
|
//! Tests for corrupt git repos.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo_test_support::paths;
|
use cargo_test_support::paths;
|
||||||
use cargo_test_support::{basic_manifest, git, project};
|
use cargo_test_support::{basic_manifest, git, project};
|
||||||
use cargo_util::paths as cargopaths;
|
use cargo_util::paths as cargopaths;
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for credential-process.
|
//! Tests for credential-process.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo_test_support::registry::{Package, TestRegistry};
|
use cargo_test_support::registry::{Package, TestRegistry};
|
||||||
use cargo_test_support::{basic_manifest, cargo_process, paths, project, registry, Project};
|
use cargo_test_support::{basic_manifest, cargo_process, paths, project, registry, Project};
|
||||||
|
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
//!
|
//!
|
||||||
//! See `cargo_test_support::cross_compile` for more detail.
|
//! See `cargo_test_support::cross_compile` for more detail.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo_test_support::rustc_host;
|
use cargo_test_support::rustc_host;
|
||||||
use cargo_test_support::{basic_bin_manifest, basic_manifest, cross_compile, project};
|
use cargo_test_support::{basic_bin_manifest, basic_manifest, cross_compile, project};
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for publishing using the `--target` flag.
|
//! Tests for publishing using the `--target` flag.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
|
|
||||||
use cargo_test_support::{cross_compile, project, publish, registry};
|
use cargo_test_support::{cross_compile, project, publish, registry};
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for custom json target specifications.
|
//! Tests for custom json target specifications.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo_test_support::{basic_manifest, project};
|
use cargo_test_support::{basic_manifest, project};
|
||||||
use std::fs;
|
use std::fs;
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for ctrl-C handling.
|
//! Tests for ctrl-C handling.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo_test_support::{project, slow_cpu_multiplier};
|
use cargo_test_support::{project, slow_cpu_multiplier};
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::io::{self, Read};
|
use std::io::{self, Read};
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
//! Tests for dep-info files. This includes the dep-info file Cargo creates in
|
//! Tests for dep-info files. This includes the dep-info file Cargo creates in
|
||||||
//! the output directory, and the ones stored in the fingerprint.
|
//! the output directory, and the ones stored in the fingerprint.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo_test_support::compare::assert_e2e;
|
use cargo_test_support::compare::assert_e2e;
|
||||||
use cargo_test_support::paths::{self, CargoPathExt};
|
use cargo_test_support::paths::{self, CargoPathExt};
|
||||||
use cargo_test_support::registry::Package;
|
use cargo_test_support::registry::Package;
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo_test_support::project;
|
use cargo_test_support::project;
|
||||||
|
|
||||||
#[cargo_test]
|
#[cargo_test]
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
//!
|
//!
|
||||||
//! Note: Some tests are located in the resolver-tests package.
|
//! Note: Some tests are located in the resolver-tests package.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo_test_support::project;
|
use cargo_test_support::project;
|
||||||
use cargo_test_support::registry::Package;
|
use cargo_test_support::registry::Package;
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for directory sources.
|
//! Tests for directory sources.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::str;
|
use std::str;
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for the `cargo doc` command.
|
//! Tests for the `cargo doc` command.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo::core::compiler::RustDocFingerprint;
|
use cargo::core::compiler::RustDocFingerprint;
|
||||||
use cargo_test_support::paths::CargoPathExt;
|
use cargo_test_support::paths::CargoPathExt;
|
||||||
use cargo_test_support::registry::Package;
|
use cargo_test_support::registry::Package;
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for the `cargo doc` command with `-Zrustdoc-scrape-examples`.
|
//! Tests for the `cargo doc` command with `-Zrustdoc-scrape-examples`.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo_test_support::project;
|
use cargo_test_support::project;
|
||||||
|
|
||||||
#[cargo_test(nightly, reason = "rustdoc scrape examples flags are unstable")]
|
#[cargo_test(nightly, reason = "rustdoc scrape examples flags are unstable")]
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for edition setting.
|
//! Tests for edition setting.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo::core::Edition;
|
use cargo::core::Edition;
|
||||||
use cargo_test_support::{basic_lib_manifest, project};
|
use cargo_test_support::{basic_lib_manifest, project};
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! General error tests that don't belong anywhere else.
|
//! General error tests that don't belong anywhere else.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo_test_support::cargo_process;
|
use cargo_test_support::cargo_process;
|
||||||
|
|
||||||
#[cargo_test]
|
#[cargo_test]
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for `[features]` table.
|
//! Tests for `[features]` table.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo_test_support::paths::CargoPathExt;
|
use cargo_test_support::paths::CargoPathExt;
|
||||||
use cargo_test_support::registry::{Dependency, Package};
|
use cargo_test_support::registry::{Dependency, Package};
|
||||||
use cargo_test_support::{basic_manifest, project};
|
use cargo_test_support::{basic_manifest, project};
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for the new feature resolver.
|
//! Tests for the new feature resolver.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo_test_support::cross_compile::{self, alternate};
|
use cargo_test_support::cross_compile::{self, alternate};
|
||||||
use cargo_test_support::install::cargo_home;
|
use cargo_test_support::install::cargo_home;
|
||||||
use cargo_test_support::paths::CargoPathExt;
|
use cargo_test_support::paths::CargoPathExt;
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for namespaced features.
|
//! Tests for namespaced features.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use super::features2::switch_to_resolver_2;
|
use super::features2::switch_to_resolver_2;
|
||||||
use cargo_test_support::registry::{Dependency, Package, RegistryBuilder};
|
use cargo_test_support::registry::{Dependency, Package, RegistryBuilder};
|
||||||
use cargo_test_support::{project, publish};
|
use cargo_test_support::{project, publish};
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for the `cargo fetch` command.
|
//! Tests for the `cargo fetch` command.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo_test_support::registry::Package;
|
use cargo_test_support::registry::Package;
|
||||||
use cargo_test_support::rustc_host;
|
use cargo_test_support::rustc_host;
|
||||||
use cargo_test_support::{basic_manifest, cross_compile, project};
|
use cargo_test_support::{basic_manifest, cross_compile, project};
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for the `cargo fix` command.
|
//! Tests for the `cargo fix` command.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo::core::Edition;
|
use cargo::core::Edition;
|
||||||
use cargo_test_support::compare::assert_e2e;
|
use cargo_test_support::compare::assert_e2e;
|
||||||
use cargo_test_support::git::{self, init};
|
use cargo_test_support::git::{self, init};
|
||||||
|
@ -14,6 +14,8 @@
|
|||||||
//! The [`expect_fix_runs_rustc_n_times`] function handles setting everything
|
//! The [`expect_fix_runs_rustc_n_times`] function handles setting everything
|
||||||
//! up, and verifying the results.
|
//! up, and verifying the results.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo_test_support::{basic_manifest, paths, project, tools, Execs};
|
use cargo_test_support::{basic_manifest, paths, project, tools, Execs};
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::sync::{Mutex, OnceLock};
|
use std::sync::{Mutex, OnceLock};
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for fingerprinting (rebuild detection).
|
//! Tests for fingerprinting (rebuild detection).
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use filetime::FileTime;
|
use filetime::FileTime;
|
||||||
use std::fs::{self, OpenOptions};
|
use std::fs::{self, OpenOptions};
|
||||||
use std::io;
|
use std::io;
|
||||||
|
@ -7,6 +7,8 @@
|
|||||||
//! So we pick some random lint that will likely always be the same
|
//! So we pick some random lint that will likely always be the same
|
||||||
//! over time.
|
//! over time.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use super::config::write_config_toml;
|
use super::config::write_config_toml;
|
||||||
use cargo_test_support::registry::Package;
|
use cargo_test_support::registry::Package;
|
||||||
use cargo_test_support::{basic_manifest, project, Project};
|
use cargo_test_support::{basic_manifest, project, Project};
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for the `cargo generate-lockfile` command.
|
//! Tests for the `cargo generate-lockfile` command.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo_test_support::registry::{Package, RegistryBuilder};
|
use cargo_test_support::registry::{Package, RegistryBuilder};
|
||||||
use cargo_test_support::{basic_manifest, paths, project, ProjectBuilder};
|
use cargo_test_support::{basic_manifest, paths, project, ProjectBuilder};
|
||||||
use std::fs;
|
use std::fs;
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for git support.
|
//! Tests for git support.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::io::prelude::*;
|
use std::io::prelude::*;
|
||||||
use std::net::{TcpListener, TcpStream};
|
use std::net::{TcpListener, TcpStream};
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for git authentication.
|
//! Tests for git authentication.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
use std::io::prelude::*;
|
use std::io::prelude::*;
|
||||||
use std::io::BufReader;
|
use std::io::BufReader;
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for git garbage collection.
|
//! Tests for git garbage collection.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::ffi::OsStr;
|
use std::ffi::OsStr;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use crate::git_gc::find_index;
|
use crate::git_gc::find_index;
|
||||||
use cargo_test_support::registry::Package;
|
use cargo_test_support::registry::Package;
|
||||||
use cargo_test_support::{basic_manifest, git, paths, project};
|
use cargo_test_support::{basic_manifest, git, paths, project};
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for target filter flags with glob patterns.
|
//! Tests for target filter flags with glob patterns.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo_test_support::{project, Project};
|
use cargo_test_support::{project, Project};
|
||||||
|
|
||||||
#[cargo_test]
|
#[cargo_test]
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
//! what happens when time passes. The [`days_ago_unix`] and
|
//! what happens when time passes. The [`days_ago_unix`] and
|
||||||
//! [`months_ago_unix`] functions help with setting this value.
|
//! [`months_ago_unix`] functions help with setting this value.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use super::config::GlobalContextBuilder;
|
use super::config::GlobalContextBuilder;
|
||||||
use cargo::core::global_cache_tracker::{self, DeferredGlobalLastUse, GlobalCacheTracker};
|
use cargo::core::global_cache_tracker::{self, DeferredGlobalLastUse, GlobalCacheTracker};
|
||||||
use cargo::util::cache_lock::CacheLockMode;
|
use cargo::util::cache_lock::CacheLockMode;
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for cargo's help output.
|
//! Tests for cargo's help output.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo_test_support::registry::Package;
|
use cargo_test_support::registry::Package;
|
||||||
use cargo_test_support::{basic_manifest, cargo_exe, cargo_process, paths, process, project};
|
use cargo_test_support::{basic_manifest, cargo_exe, cargo_process, paths, process, project};
|
||||||
use std::fs;
|
use std::fs;
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
//! Note that these tests will generally require setting CARGO_CONTAINER_TESTS
|
//! Note that these tests will generally require setting CARGO_CONTAINER_TESTS
|
||||||
//! or CARGO_PUBLIC_NETWORK_TESTS.
|
//! or CARGO_PUBLIC_NETWORK_TESTS.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo_test_support::containers::Container;
|
use cargo_test_support::containers::Container;
|
||||||
use cargo_test_support::project;
|
use cargo_test_support::project;
|
||||||
|
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
//! Tests for inheriting Cargo.toml fields with field.workspace = true
|
//! Tests for inheriting Cargo.toml fields with field.workspace = true
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo_test_support::registry::{Dependency, Package, RegistryBuilder};
|
use cargo_test_support::registry::{Dependency, Package, RegistryBuilder};
|
||||||
use cargo_test_support::{
|
use cargo_test_support::{
|
||||||
basic_lib_manifest, basic_manifest, git, path2url, paths, project, publish, registry,
|
basic_lib_manifest, basic_manifest, git, path2url, paths, project, publish, registry,
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for the `cargo install` command.
|
//! Tests for the `cargo install` command.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use std::fs::{self, OpenOptions};
|
use std::fs::{self, OpenOptions};
|
||||||
use std::io::prelude::*;
|
use std::io::prelude::*;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for `cargo install` where it upgrades a package if it is out-of-date.
|
//! Tests for `cargo install` where it upgrades a package if it is out-of-date.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo::core::PackageId;
|
use cargo::core::PackageId;
|
||||||
use std::collections::BTreeSet;
|
use std::collections::BTreeSet;
|
||||||
use std::env;
|
use std::env;
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for the jobserver protocol.
|
//! Tests for the jobserver protocol.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo_util::is_ci;
|
use cargo_util::is_ci;
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::net::TcpListener;
|
use std::net::TcpListener;
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo_test_support::project;
|
use cargo_test_support::project;
|
||||||
use cargo_test_support::registry::Package;
|
use cargo_test_support::registry::Package;
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo_test_support::project;
|
use cargo_test_support::project;
|
||||||
use cargo_test_support::registry::Package;
|
use cargo_test_support::registry::Package;
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo_test_support::project;
|
use cargo_test_support::project;
|
||||||
|
|
||||||
#[cargo_test]
|
#[cargo_test]
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo_test_support::project;
|
use cargo_test_support::project;
|
||||||
use cargo_test_support::registry::Package;
|
use cargo_test_support::registry::Package;
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for `[lints]`
|
//! Tests for `[lints]`
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo_test_support::project;
|
use cargo_test_support::project;
|
||||||
use cargo_test_support::registry::Package;
|
use cargo_test_support::registry::Package;
|
||||||
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
//! Tests for packages/target filter flags giving suggestions on which
|
//! Tests for packages/target filter flags giving suggestions on which
|
||||||
//! packages/targets are available.
|
//! packages/targets are available.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo_test_support::project;
|
use cargo_test_support::project;
|
||||||
|
|
||||||
const EXAMPLE: u8 = 1 << 0;
|
const EXAMPLE: u8 = 1 << 0;
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for local-registry sources.
|
//! Tests for local-registry sources.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo_test_support::paths::{self, CargoPathExt};
|
use cargo_test_support::paths::{self, CargoPathExt};
|
||||||
use cargo_test_support::registry::{registry_path, Package};
|
use cargo_test_support::registry::{registry_path, Package};
|
||||||
use cargo_test_support::{basic_manifest, project, t};
|
use cargo_test_support::{basic_manifest, project, t};
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for the `cargo locate-project` command.
|
//! Tests for the `cargo locate-project` command.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo_test_support::project;
|
use cargo_test_support::project;
|
||||||
|
|
||||||
#[cargo_test]
|
#[cargo_test]
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for supporting older versions of the Cargo.lock file format.
|
//! Tests for supporting older versions of the Cargo.lock file format.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo_test_support::compare::assert_e2e;
|
use cargo_test_support::compare::assert_e2e;
|
||||||
use cargo_test_support::git;
|
use cargo_test_support::git;
|
||||||
use cargo_test_support::registry::Package;
|
use cargo_test_support::registry::Package;
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for the `cargo login` command.
|
//! Tests for the `cargo login` command.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo_test_support::cargo_process;
|
use cargo_test_support::cargo_process;
|
||||||
use cargo_test_support::paths::{self, CargoPathExt};
|
use cargo_test_support::paths::{self, CargoPathExt};
|
||||||
use cargo_test_support::registry::{self, RegistryBuilder};
|
use cargo_test_support::registry::{self, RegistryBuilder};
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for the `cargo logout` command.
|
//! Tests for the `cargo logout` command.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use super::login::check_token;
|
use super::login::check_token;
|
||||||
use cargo_test_support::paths::{self, CargoPathExt};
|
use cargo_test_support::paths::{self, CargoPathExt};
|
||||||
use cargo_test_support::registry::TestRegistry;
|
use cargo_test_support::registry::TestRegistry;
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo::core::compiler::Lto;
|
use cargo::core::compiler::Lto;
|
||||||
use cargo_test_support::registry::Package;
|
use cargo_test_support::registry::Package;
|
||||||
use cargo_test_support::{basic_manifest, project, Project};
|
use cargo_test_support::{basic_manifest, project, Project};
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for workspace member discovery.
|
//! Tests for workspace member discovery.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo::core::{Shell, Workspace};
|
use cargo::core::{Shell, Workspace};
|
||||||
use cargo::util::context::GlobalContext;
|
use cargo::util::context::GlobalContext;
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for workspace member errors.
|
//! Tests for workspace member errors.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo::core::resolver::ResolveError;
|
use cargo::core::resolver::ResolveError;
|
||||||
use cargo::core::{compiler::CompileMode, Shell, Workspace};
|
use cargo::core::{compiler::CompileMode, Shell, Workspace};
|
||||||
use cargo::ops::{self, CompileOptions};
|
use cargo::ops::{self, CompileOptions};
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for --message-format flag.
|
//! Tests for --message-format flag.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo_test_support::{basic_lib_manifest, basic_manifest, project};
|
use cargo_test_support::{basic_lib_manifest, basic_manifest, project};
|
||||||
|
|
||||||
#[cargo_test]
|
#[cargo_test]
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
//!
|
//!
|
||||||
//! Tests for message caching can be found in `cache_messages`.
|
//! Tests for message caching can be found in `cache_messages`.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo_test_support::{process, project, Project};
|
use cargo_test_support::{process, project, Project};
|
||||||
use cargo_util::ProcessError;
|
use cargo_util::ProcessError;
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for the metabuild feature (declarative build scripts).
|
//! Tests for the metabuild feature (declarative build scripts).
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo_test_support::{
|
use cargo_test_support::{
|
||||||
basic_lib_manifest, basic_manifest, is_coarse_mtime, project, registry::Package, rustc_host,
|
basic_lib_manifest, basic_manifest, is_coarse_mtime, project, registry::Package, rustc_host,
|
||||||
Project,
|
Project,
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for the `cargo metadata` command.
|
//! Tests for the `cargo metadata` command.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo_test_support::install::cargo_home;
|
use cargo_test_support::install::cargo_home;
|
||||||
use cargo_test_support::paths::CargoPathExt;
|
use cargo_test_support::paths::CargoPathExt;
|
||||||
use cargo_test_support::registry::Package;
|
use cargo_test_support::registry::Package;
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
//!
|
//!
|
||||||
//! Note: Some tests are located in the resolver-tests package.
|
//! Note: Some tests are located in the resolver-tests package.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo_test_support::project;
|
use cargo_test_support::project;
|
||||||
use cargo_test_support::registry::Package;
|
use cargo_test_support::registry::Package;
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for multiple `--target` flags to subcommands
|
//! Tests for multiple `--target` flags to subcommands
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo_test_support::{basic_manifest, cross_compile, project, rustc_host};
|
use cargo_test_support::{basic_manifest, cross_compile, project, rustc_host};
|
||||||
|
|
||||||
#[cargo_test]
|
#[cargo_test]
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for network configuration.
|
//! Tests for network configuration.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo_test_support::project;
|
use cargo_test_support::project;
|
||||||
|
|
||||||
#[cargo_test]
|
#[cargo_test]
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for the `cargo new` command.
|
//! Tests for the `cargo new` command.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo_test_support::cargo_process;
|
use cargo_test_support::cargo_process;
|
||||||
use cargo_test_support::paths;
|
use cargo_test_support::paths;
|
||||||
use std::env;
|
use std::env;
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for --offline flag.
|
//! Tests for --offline flag.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo_test_support::{
|
use cargo_test_support::{
|
||||||
basic_manifest, git, main_file, path2url, project,
|
basic_manifest, git, main_file, path2url, project,
|
||||||
registry::{Package, RegistryBuilder},
|
registry::{Package, RegistryBuilder},
|
||||||
|
@ -10,6 +10,8 @@
|
|||||||
//! cargo test --test testsuite -- old_cargos --nocapture --ignored
|
//! cargo test --test testsuite -- old_cargos --nocapture --ignored
|
||||||
//! ```
|
//! ```
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo::CargoResult;
|
use cargo::CargoResult;
|
||||||
use cargo_test_support::paths::CargoPathExt;
|
use cargo_test_support::paths::CargoPathExt;
|
||||||
use cargo_test_support::registry::{self, Dependency, Package};
|
use cargo_test_support::registry::{self, Dependency, Package};
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo_test_support::project;
|
use cargo_test_support::project;
|
||||||
use cargo_test_support::registry::RegistryBuilder;
|
use cargo_test_support::registry::RegistryBuilder;
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for the `cargo owner` command.
|
//! Tests for the `cargo owner` command.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use std::fs;
|
use std::fs;
|
||||||
|
|
||||||
use cargo_test_support::paths::CargoPathExt;
|
use cargo_test_support::paths::CargoPathExt;
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for the `cargo package` command.
|
//! Tests for the `cargo package` command.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo_test_support::paths::CargoPathExt;
|
use cargo_test_support::paths::CargoPathExt;
|
||||||
use cargo_test_support::publish::validate_crate_contents;
|
use cargo_test_support::publish::validate_crate_contents;
|
||||||
use cargo_test_support::registry::{self, Package};
|
use cargo_test_support::registry::{self, Package};
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for feature selection on the command-line.
|
//! Tests for feature selection on the command-line.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use super::features2::switch_to_resolver_2;
|
use super::features2::switch_to_resolver_2;
|
||||||
use cargo_test_support::registry::{Dependency, Package};
|
use cargo_test_support::registry::{Dependency, Package};
|
||||||
use cargo_test_support::{basic_manifest, project};
|
use cargo_test_support::{basic_manifest, project};
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for `[patch]` table source replacement.
|
//! Tests for `[patch]` table source replacement.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo_test_support::git;
|
use cargo_test_support::git;
|
||||||
use cargo_test_support::paths;
|
use cargo_test_support::paths;
|
||||||
use cargo_test_support::registry::{self, Package};
|
use cargo_test_support::registry::{self, Package};
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
//! Tests for `path` dependencies.
|
//! Tests for `path` dependencies.
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cargo_test_support::paths::{self, CargoPathExt};
|
use cargo_test_support::paths::{self, CargoPathExt};
|
||||||
use cargo_test_support::registry::Package;
|
use cargo_test_support::registry::Package;
|
||||||
use cargo_test_support::{basic_lib_manifest, basic_manifest, main_file, project};
|
use cargo_test_support::{basic_lib_manifest, basic_manifest, main_file, project};
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user