diff --git a/tests/testsuite/patch.rs b/tests/testsuite/patch.rs index 4872d822f6b..417773bf837 100644 --- a/tests/testsuite/patch.rs +++ b/tests/testsuite/patch.rs @@ -1,11 +1,10 @@ //! Tests for `[patch]` table source replacement. -#![allow(deprecated)] - use cargo_test_support::git; use cargo_test_support::paths; +use cargo_test_support::prelude::*; use cargo_test_support::registry::{self, Package}; -use cargo_test_support::{basic_manifest, project}; +use cargo_test_support::{basic_manifest, project, str}; use std::fs; #[cargo_test] @@ -53,21 +52,25 @@ fn replace() { .build(); p.cargo("check") - .with_stderr( - "\ + .with_stderr_data(str![[r#" [UPDATING] `dummy-registry` index [LOCKING] 3 packages to latest compatible versions [DOWNLOADING] crates ... -[DOWNLOADED] baz v0.1.0 ([..]) -[CHECKING] bar v0.1.0 ([CWD]/bar) +[DOWNLOADED] baz v0.1.0 (registry `dummy-registry`) +[CHECKING] bar v0.1.0 ([ROOT]/foo/bar) [CHECKING] baz v0.1.0 -[CHECKING] foo v0.0.1 ([CWD]) -[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..] -", - ) +[CHECKING] foo v0.0.1 ([ROOT]/foo) +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]) .run(); - p.cargo("check").with_stderr("[FINISHED] [..]").run(); + p.cargo("check") + .with_stderr_data(str![[r#" +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]) + .run(); } #[cargo_test] @@ -101,15 +104,14 @@ fn from_config() { .build(); p.cargo("check") - .with_stderr( - "\ + .with_stderr_data(str![[r#" [UPDATING] `dummy-registry` index [LOCKING] 2 packages to latest compatible versions -[CHECKING] bar v0.1.1 ([..]) -[CHECKING] foo v0.0.1 ([CWD]) -[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..] -", - ) +[CHECKING] bar v0.1.1 ([ROOT]/foo/bar) +[CHECKING] foo v0.0.1 ([ROOT]/foo) +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]) .run(); } @@ -144,15 +146,14 @@ fn from_config_relative() { .build(); p.cargo("check") - .with_stderr( - "\ + .with_stderr_data(str![[r#" [UPDATING] `dummy-registry` index [LOCKING] 2 packages to latest compatible versions -[CHECKING] bar v0.1.1 ([..]) -[CHECKING] foo v0.0.1 ([CWD]) -[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..] -", - ) +[CHECKING] bar v0.1.1 ([ROOT]/foo/bar) +[CHECKING] foo v0.0.1 ([ROOT]/foo) +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]) .run(); } @@ -190,15 +191,14 @@ fn from_config_precedence() { .build(); p.cargo("check") - .with_stderr( - "\ + .with_stderr_data(str![[r#" [UPDATING] `dummy-registry` index [LOCKING] 2 packages to latest compatible versions -[CHECKING] bar v0.1.1 ([..]) -[CHECKING] foo v0.0.1 ([CWD]) -[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..] -", - ) +[CHECKING] bar v0.1.1 ([ROOT]/foo/bar) +[CHECKING] foo v0.0.1 ([ROOT]/foo) +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]) .run(); } @@ -232,17 +232,21 @@ fn nonexistent() { .build(); p.cargo("check") - .with_stderr( - "\ + .with_stderr_data(str![[r#" [UPDATING] `dummy-registry` 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(); + p.cargo("check") + .with_stderr_data(str![[r#" +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]) .run(); - p.cargo("check").with_stderr("[FINISHED] [..]").run(); } #[cargo_test] @@ -281,17 +285,21 @@ fn patch_git() { .build(); p.cargo("check") - .with_stderr( - "\ -[UPDATING] git repository `file://[..]` + .with_stderr_data(str![[r#" +[UPDATING] git repository `[ROOTURL]/override` [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(); + p.cargo("check") + .with_stderr_data(str![[r#" +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]) .run(); - p.cargo("check").with_stderr("[FINISHED] [..]").run(); } #[cargo_test] @@ -330,18 +338,22 @@ fn patch_to_git() { .build(); p.cargo("check") - .with_stderr( - "\ -[UPDATING] git repository `file://[..]` + .with_stderr_data(str![[r#" +[UPDATING] git repository `[ROOTURL]/override` [UPDATING] `dummy-registry` index [LOCKING] 2 packages to latest compatible versions -[CHECKING] bar v0.1.0 (file://[..]) -[CHECKING] foo v0.0.1 ([CWD]) -[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..] -", - ) +[CHECKING] bar v0.1.0 ([ROOTURL]/override#[..]) +[CHECKING] foo v0.0.1 ([ROOT]/foo) +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]) + .run(); + p.cargo("check") + .with_stderr_data(str![[r#" +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]) .run(); - p.cargo("check").with_stderr("[FINISHED] [..]").run(); } #[cargo_test] @@ -371,35 +383,33 @@ fn unused() { .build(); p.cargo("check") - .with_stderr( - "\ + .with_stderr_data(str![[r#" [UPDATING] `dummy-registry` index -[WARNING] Patch `bar v0.2.0 ([CWD]/bar)` was not used in the crate graph. -Check that [..] -with the [..] -what is [..] -version. [..] +[WARNING] Patch `bar v0.2.0 ([ROOT]/foo/bar)` was not used in the crate graph. +Check that the patched package version and available features are compatible +with the dependency requirements. If the patch has a different version from +what is locked in the Cargo.lock file, run `cargo update` to use the new +version. This may also occur with an optional dependency that is not enabled. [LOCKING] 2 packages to latest compatible versions [ADDING] bar v0.1.0 (latest: v0.2.0) [DOWNLOADING] crates ... -[DOWNLOADED] bar v0.1.0 [..] +[DOWNLOADED] bar v0.1.0 (registry `dummy-registry`) [CHECKING] bar v0.1.0 -[CHECKING] foo v0.0.1 ([CWD]) -[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..] -", - ) +[CHECKING] foo v0.0.1 ([ROOT]/foo) +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]) .run(); p.cargo("check") - .with_stderr( - "\ -[WARNING] Patch `bar v0.2.0 ([CWD]/bar)` was not used in the crate graph. -Check that [..] -with the [..] -what is [..] -version. [..] -[FINISHED] [..] -", - ) + .with_stderr_data(str![[r#" +[WARNING] Patch `bar v0.2.0 ([ROOT]/foo/bar)` was not used in the crate graph. +Check that the patched package version and available features are compatible +with the dependency requirements. If the patch has a different version from +what is locked in the Cargo.lock file, run `cargo update` to use the new +version. This may also occur with an optional dependency that is not enabled. +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]) .run(); // unused patch should be in the lock file @@ -446,27 +456,26 @@ fn unused_with_mismatch_source_being_patched() { .build(); p.cargo("check") - .with_stderr( - "\ + .with_stderr_data(str![[r#" [UPDATING] `dummy-registry` index -[WARNING] Patch `bar v0.2.0 ([CWD]/bar)` was not used in the crate graph. +[WARNING] Patch `bar v0.2.0 ([ROOT]/foo/bar)` was not used in the crate graph. Perhaps you misspelled the source URL being patched. Possible URLs for `[patch.]`: crates-io -[WARNING] Patch `bar v0.3.0 ([CWD]/baz)` was not used in the crate graph. -Check that [..] -with the [..] -what is [..] -version. [..] +[WARNING] Patch `bar v0.3.0 ([ROOT]/foo/baz)` was not used in the crate graph. +Check that the patched package version and available features are compatible +with the dependency requirements. If the patch has a different version from +what is locked in the Cargo.lock file, run `cargo update` to use the new +version. This may also occur with an optional dependency that is not enabled. [LOCKING] 2 packages to latest compatible versions [ADDING] bar v0.1.0 (latest: v0.3.0) [DOWNLOADING] crates ... -[DOWNLOADED] bar v0.1.0 [..] +[DOWNLOADED] bar v0.1.0 (registry `dummy-registry`) [CHECKING] bar v0.1.0 -[CHECKING] foo v0.0.1 ([CWD]) -[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..] -", - ) +[CHECKING] foo v0.0.1 ([ROOT]/foo) +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]) .run(); } @@ -497,22 +506,20 @@ fn prefer_patch_version() { .build(); p.cargo("check") - .with_stderr( - "\ + .with_stderr_data(str![[r#" [UPDATING] `dummy-registry` index [LOCKING] 2 packages to latest compatible versions -[CHECKING] bar v0.1.1 ([CWD]/bar) -[CHECKING] foo v0.0.1 ([CWD]) -[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..] -", - ) +[CHECKING] bar v0.1.1 ([ROOT]/foo/bar) +[CHECKING] foo v0.0.1 ([ROOT]/foo) +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]) .run(); p.cargo("check") - .with_stderr( - "\ -[FINISHED] [..] -", - ) + .with_stderr_data(str![[r#" +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]) .run(); // there should be no patch.unused in the toml file @@ -552,35 +559,33 @@ fn unused_from_config() { .build(); p.cargo("check") - .with_stderr( - "\ + .with_stderr_data(str![[r#" [UPDATING] `dummy-registry` index -[WARNING] Patch `bar v0.2.0 ([CWD]/bar)` was not used in the crate graph. -Check that [..] -with the [..] -what is [..] -version. [..] +[WARNING] Patch `bar v0.2.0 ([ROOT]/foo/bar)` was not used in the crate graph. +Check that the patched package version and available features are compatible +with the dependency requirements. If the patch has a different version from +what is locked in the Cargo.lock file, run `cargo update` to use the new +version. This may also occur with an optional dependency that is not enabled. [LOCKING] 2 packages to latest compatible versions [ADDING] bar v0.1.0 (latest: v0.2.0) [DOWNLOADING] crates ... -[DOWNLOADED] bar v0.1.0 [..] +[DOWNLOADED] bar v0.1.0 (registry `dummy-registry`) [CHECKING] bar v0.1.0 -[CHECKING] foo v0.0.1 ([CWD]) -[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..] -", - ) +[CHECKING] foo v0.0.1 ([ROOT]/foo) +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]) .run(); p.cargo("check") - .with_stderr( - "\ -[WARNING] Patch `bar v0.2.0 ([CWD]/bar)` was not used in the crate graph. -Check that [..] -with the [..] -what is [..] -version. [..] -[FINISHED] [..] -", - ) + .with_stderr_data(str![[r#" +[WARNING] Patch `bar v0.2.0 ([ROOT]/foo/bar)` was not used in the crate graph. +Check that the patched package version and available features are compatible +with the dependency requirements. If the patch has a different version from +what is locked in the Cargo.lock file, run `cargo update` to use the new +version. This may also occur with an optional dependency that is not enabled. +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]) .run(); // unused patch should be in the lock file @@ -627,36 +632,34 @@ fn unused_git() { .build(); p.cargo("check") - .with_stderr( - "\ -[UPDATING] git repository `file://[..]` + .with_stderr_data(str![[r#" +[UPDATING] git repository `[ROOTURL]/override` [UPDATING] `dummy-registry` index -[WARNING] Patch `bar v0.2.0 ([..])` was not used in the crate graph. -Check that [..] -with the [..] -what is [..] -version. [..] +[WARNING] Patch `bar v0.2.0 ([ROOTURL]/override#[..])` was not used in the crate graph. +Check that the patched package version and available features are compatible +with the dependency requirements. If the patch has a different version from +what is locked in the Cargo.lock file, run `cargo update` to use the new +version. This may also occur with an optional dependency that is not enabled. [LOCKING] 2 packages to latest compatible versions [ADDING] bar v0.1.0 (latest: v0.2.0) [DOWNLOADING] crates ... -[DOWNLOADED] bar v0.1.0 [..] +[DOWNLOADED] bar v0.1.0 (registry `dummy-registry`) [CHECKING] bar v0.1.0 -[CHECKING] foo v0.0.1 ([CWD]) -[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..] -", - ) +[CHECKING] foo v0.0.1 ([ROOT]/foo) +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]) .run(); p.cargo("check") - .with_stderr( - "\ -[WARNING] Patch `bar v0.2.0 ([..])` was not used in the crate graph. -Check that [..] -with the [..] -what is [..] -version. [..] -[FINISHED] [..] -", - ) + .with_stderr_data(str![[r#" +[WARNING] Patch `bar v0.2.0 ([ROOTURL]/override#[..])` was not used in the crate graph. +Check that the patched package version and available features are compatible +with the dependency requirements. If the patch has a different version from +what is locked in the Cargo.lock file, run `cargo update` to use the new +version. This may also occur with an optional dependency that is not enabled. +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]) .run(); } @@ -684,19 +687,23 @@ fn add_patch() { .build(); p.cargo("check") - .with_stderr( - "\ + .with_stderr_data(str![[r#" [UPDATING] `dummy-registry` index [LOCKING] 2 packages to latest compatible versions [DOWNLOADING] crates ... -[DOWNLOADED] bar v0.1.0 [..] +[DOWNLOADED] bar v0.1.0 (registry `dummy-registry`) [CHECKING] bar v0.1.0 -[CHECKING] foo v0.0.1 ([CWD]) -[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..] -", - ) +[CHECKING] foo v0.0.1 ([ROOT]/foo) +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]) + .run(); + p.cargo("check") + .with_stderr_data(str![[r#" +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]) .run(); - p.cargo("check").with_stderr("[FINISHED] [..]").run(); p.change_file( "Cargo.toml", @@ -716,17 +723,21 @@ fn add_patch() { ); p.cargo("check") - .with_stderr( - "\ + .with_stderr_data(str![[r#" [LOCKING] 1 package to latest compatible version -[ADDING] bar v0.1.0 ([CWD]/bar) -[CHECKING] bar v0.1.0 ([CWD]/bar) -[CHECKING] foo v0.0.1 ([CWD]) -[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..] -", - ) +[ADDING] bar v0.1.0 ([ROOT]/foo/bar) +[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(); + p.cargo("check") + .with_stderr_data(str![[r#" +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]) .run(); - p.cargo("check").with_stderr("[FINISHED] [..]").run(); } #[cargo_test] @@ -753,19 +764,23 @@ fn add_patch_from_config() { .build(); p.cargo("check") - .with_stderr( - "\ + .with_stderr_data(str![[r#" [UPDATING] `dummy-registry` index [LOCKING] 2 packages to latest compatible versions [DOWNLOADING] crates ... -[DOWNLOADED] bar v0.1.0 [..] +[DOWNLOADED] bar v0.1.0 (registry `dummy-registry`) [CHECKING] bar v0.1.0 -[CHECKING] foo v0.0.1 ([CWD]) -[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..] -", - ) +[CHECKING] foo v0.0.1 ([ROOT]/foo) +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]) + .run(); + p.cargo("check") + .with_stderr_data(str![[r#" +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]) .run(); - p.cargo("check").with_stderr("[FINISHED] [..]").run(); p.change_file( ".cargo/config.toml", @@ -776,17 +791,21 @@ fn add_patch_from_config() { ); p.cargo("check") - .with_stderr( - "\ + .with_stderr_data(str![[r#" [LOCKING] 1 package to latest compatible version -[ADDING] bar v0.1.0 ([CWD]/bar) -[CHECKING] bar v0.1.0 ([CWD]/bar) -[CHECKING] foo v0.0.1 ([CWD]) -[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..] -", - ) +[ADDING] bar v0.1.0 ([ROOT]/foo/bar) +[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(); + p.cargo("check") + .with_stderr_data(str![[r#" +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]) .run(); - p.cargo("check").with_stderr("[FINISHED] [..]").run(); } #[cargo_test] @@ -813,19 +832,23 @@ fn add_ignored_patch() { .build(); p.cargo("check") - .with_stderr( - "\ + .with_stderr_data(str![[r#" [UPDATING] `dummy-registry` index [LOCKING] 2 packages to latest compatible versions [DOWNLOADING] crates ... -[DOWNLOADED] bar v0.1.0 [..] +[DOWNLOADED] bar v0.1.0 (registry `dummy-registry`) [CHECKING] bar v0.1.0 -[CHECKING] foo v0.0.1 ([CWD]) -[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..] -", - ) +[CHECKING] foo v0.0.1 ([ROOT]/foo) +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]) + .run(); + p.cargo("check") + .with_stderr_data(str![[r#" +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]) .run(); - p.cargo("check").with_stderr("[FINISHED] [..]").run(); p.change_file( "Cargo.toml", @@ -845,37 +868,36 @@ fn add_ignored_patch() { ); p.cargo("check") - .with_stderr( - "\ -[WARNING] Patch `bar v0.1.1 ([CWD]/bar)` was not used in the crate graph. -Check that [..] -with the [..] -what is [..] -version. [..] -[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]", - ) + .with_stderr_data(str![[r#" +[WARNING] Patch `bar v0.1.1 ([ROOT]/foo/bar)` was not used in the crate graph. +Check that the patched package version and available features are compatible +with the dependency requirements. If the patch has a different version from +what is locked in the Cargo.lock file, run `cargo update` to use the new +version. This may also occur with an optional dependency that is not enabled. +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]) .run(); p.cargo("check") - .with_stderr( - "\ -[WARNING] Patch `bar v0.1.1 ([CWD]/bar)` was not used in the crate graph. -Check that [..] -with the [..] -what is [..] -version. [..] -[FINISHED] [..]", - ) + .with_stderr_data(str![[r#" +[WARNING] Patch `bar v0.1.1 ([ROOT]/foo/bar)` was not used in the crate graph. +Check that the patched package version and available features are compatible +with the dependency requirements. If the patch has a different version from +what is locked in the Cargo.lock file, run `cargo update` to use the new +version. This may also occur with an optional dependency that is not enabled. +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]) .run(); p.cargo("update").run(); p.cargo("check") - .with_stderr( - "\ -[CHECKING] bar v0.1.1 ([CWD]/bar) -[CHECKING] foo v0.0.1 ([CWD]) -[FINISHED] `dev` profile [..] -", - ) + .with_stderr_data(str![[r#" +[CHECKING] bar v0.1.1 ([ROOT]/foo/bar) +[CHECKING] foo v0.0.1 ([ROOT]/foo) +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]) .run(); } @@ -905,28 +927,20 @@ fn add_patch_with_features() { .file("bar/src/lib.rs", r#""#) .build(); - p.cargo("check") - .with_stderr( - "\ -[WARNING] patch for `bar` uses the features mechanism. \ -default-features and features will not take effect because the patch dependency does not support this mechanism + p.cargo("check").with_stderr_data(str![[r#" +[WARNING] patch for `bar` uses the features mechanism. default-features and features will not take effect because the patch dependency does not support this mechanism [UPDATING] `dummy-registry` 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 [..] -", - ) - .run(); - p.cargo("check") - .with_stderr( - "\ -[WARNING] patch for `bar` uses the features mechanism. \ -default-features and features will not take effect because the patch dependency does not support this mechanism -[FINISHED] [..] -", - ) - .run(); +[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(); + p.cargo("check").with_stderr_data(str![[r#" +[WARNING] patch for `bar` uses the features mechanism. default-features and features will not take effect because the patch dependency does not support this mechanism +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]).run(); } #[cargo_test] @@ -955,28 +969,20 @@ fn add_patch_with_setting_default_features() { .file("bar/src/lib.rs", r#""#) .build(); - p.cargo("check") - .with_stderr( - "\ -[WARNING] patch for `bar` uses the features mechanism. \ -default-features and features will not take effect because the patch dependency does not support this mechanism + p.cargo("check").with_stderr_data(str![[r#" +[WARNING] patch for `bar` uses the features mechanism. default-features and features will not take effect because the patch dependency does not support this mechanism [UPDATING] `dummy-registry` 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 [..] -", - ) - .run(); - p.cargo("check") - .with_stderr( - "\ -[WARNING] patch for `bar` uses the features mechanism. \ -default-features and features will not take effect because the patch dependency does not support this mechanism -[FINISHED] [..] -", - ) - .run(); +[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(); + p.cargo("check").with_stderr_data(str![[r#" +[WARNING] patch for `bar` uses the features mechanism. default-features and features will not take effect because the patch dependency does not support this mechanism +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]).run(); } #[cargo_test] @@ -1015,13 +1021,13 @@ fn no_warn_ws_patch() { .build(); p.cargo("check -p a") - .with_stderr( - "\ -[UPDATING] [..] + .with_stderr_data(str![[r#" +[UPDATING] `dummy-registry` index [LOCKING] 3 packages to latest compatible versions -[CHECKING] a [..] -[FINISHED] [..]", - ) +[CHECKING] a v0.1.0 ([ROOT]/foo/a) +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]) .run(); } @@ -1052,15 +1058,14 @@ fn new_minor() { .build(); p.cargo("check") - .with_stderr( - "\ + .with_stderr_data(str![[r#" [UPDATING] `dummy-registry` index [LOCKING] 2 packages to latest compatible versions -[CHECKING] bar v0.1.1 [..] -[CHECKING] foo v0.0.1 ([CWD]) -[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..] -", - ) +[CHECKING] bar v0.1.1 ([ROOT]/foo/bar) +[CHECKING] foo v0.0.1 ([ROOT]/foo) +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]) .run(); } @@ -1105,16 +1110,15 @@ fn transitive_new_minor() { .build(); p.cargo("check") - .with_stderr( - "\ + .with_stderr_data(str![[r#" [UPDATING] `dummy-registry` index [LOCKING] 3 packages to latest compatible versions -[CHECKING] baz v0.1.1 [..] -[CHECKING] bar v0.1.0 [..] -[CHECKING] foo v0.0.1 ([CWD]) -[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..] -", - ) +[CHECKING] baz v0.1.1 ([ROOT]/foo/baz) +[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(); } @@ -1145,21 +1149,23 @@ fn new_major() { .build(); p.cargo("check") - .with_stderr( - "\ + .with_stderr_data(str![[r#" [UPDATING] `dummy-registry` index [LOCKING] 2 packages to latest compatible versions -[CHECKING] bar v0.2.0 [..] -[CHECKING] foo v0.0.1 ([CWD]) -[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..] -", - ) +[CHECKING] bar v0.2.0 ([ROOT]/foo/bar) +[CHECKING] foo v0.0.1 ([ROOT]/foo) +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]) .run(); Package::new("bar", "0.2.0").publish(); p.cargo("update").run(); p.cargo("check") - .with_stderr("[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]") + .with_stderr_data(str![[r#" +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]) .run(); p.change_file( @@ -1176,18 +1182,17 @@ fn new_major() { "#, ); p.cargo("check") - .with_stderr( - "\ + .with_stderr_data(str![[r#" [UPDATING] `dummy-registry` index [LOCKING] 1 package to latest compatible version [ADDING] bar v0.2.0 [DOWNLOADING] crates ... -[DOWNLOADED] bar v0.2.0 [..] +[DOWNLOADED] bar v0.2.0 (registry `dummy-registry`) [CHECKING] bar v0.2.0 -[CHECKING] foo v0.0.1 ([CWD]) -[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..] -", - ) +[CHECKING] foo v0.0.1 ([ROOT]/foo) +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]) .run(); } @@ -1232,16 +1237,15 @@ fn transitive_new_major() { .build(); p.cargo("check") - .with_stderr( - "\ + .with_stderr_data(str![[r#" [UPDATING] `dummy-registry` index [LOCKING] 3 packages to latest compatible versions -[CHECKING] baz v0.2.0 [..] -[CHECKING] bar v0.1.0 [..] -[CHECKING] foo v0.0.1 ([CWD]) -[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..] -", - ) +[CHECKING] baz v0.2.0 ([ROOT]/foo/baz) +[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(); } @@ -1291,17 +1295,16 @@ fn shared_by_transitive() { .build(); p.cargo("check") - .with_stderr( - "\ -[UPDATING] git repository `file://[..]` + .with_stderr_data(str![[r#" +[UPDATING] git repository `[ROOTURL]/override` [UPDATING] `dummy-registry` index [LOCKING] 3 packages to latest compatible versions -[CHECKING] baz v0.1.2 [..] -[CHECKING] bar v0.1.0 [..] -[CHECKING] foo v0.1.0 ([CWD]) -[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..] -", - ) +[CHECKING] baz v0.1.2 ([ROOTURL]/override#[..]) +[CHECKING] bar v0.1.0 ([ROOT]/foo/bar) +[CHECKING] foo v0.1.0 ([ROOT]/foo) +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]) .run(); } @@ -1394,17 +1397,16 @@ fn non_crates_io() { p.cargo("check") .with_status(101) - .with_stderr( - "\ -error: failed to parse manifest at `[..]` + .with_stderr_data(str![[r#" +[ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml` Caused by: [patch] entry `some-other-source` should be a URL or registry name Caused by: invalid url `some-other-source`: relative URL without a base -", - ) + +"#]]) .run(); } @@ -1433,16 +1435,14 @@ fn replace_with_crates_io() { p.cargo("check") .with_status(101) - .with_stderr( - "\ -[UPDATING] [..] -error: failed to resolve patches for `[..]` + .with_stderr_data(str![[r#" +[UPDATING] `dummy-registry` index +[ERROR] failed to resolve patches for `https://github.com/rust-lang/crates.io-index` Caused by: - patch for `bar` in `[..]` points to the same source, but patches must point \ - to different sources -", - ) + patch for `bar` in `https://github.com/rust-lang/crates.io-index` points to the same source, but patches must point to different sources + +"#]]) .run(); } @@ -1480,7 +1480,12 @@ fn patch_in_virtual() { .build(); p.cargo("check").run(); - p.cargo("check").with_stderr("[FINISHED] [..]").run(); + p.cargo("check") + .with_stderr_data(str![[r#" +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]) + .run(); } #[cargo_test] @@ -1535,7 +1540,12 @@ fn patch_depends_on_another_patch() { p.cargo("check").run(); // Nothing should be rebuilt, no registry should be updated. - p.cargo("check").with_stderr("[FINISHED] [..]").run(); + p.cargo("check") + .with_stderr_data(str![[r#" +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]) + .run(); } #[cargo_test] @@ -1636,16 +1646,15 @@ fn patch_older() { .build(); p.cargo("check") - .with_stderr( - "\ -[UPDATING] [..] + .with_stderr_data(str![[r#" +[UPDATING] `dummy-registry` index [LOCKING] 3 packages to latest compatible versions -[CHECKING] baz v1.0.1 [..] -[CHECKING] bar v0.5.0 [..] -[CHECKING] foo v0.1.0 [..] -[FINISHED] [..] -", - ) +[CHECKING] baz v1.0.1 ([ROOT]/foo/baz) +[CHECKING] bar v0.5.0 ([ROOT]/foo/bar) +[CHECKING] foo v0.1.0 ([ROOT]/foo) +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]) .run(); } @@ -1695,15 +1704,14 @@ fn cycle() { p.cargo("check") .with_status(101) - .with_stderr( - "\ -[UPDATING] [..] -[ERROR] cyclic package dependency: [..] -package `[..]` - ... which satisfies dependency `[..]` of package `[..]` - ... which satisfies dependency `[..]` of package `[..]` -", - ) + .with_stderr_data(str![[r#" +[UPDATING] `dummy-registry` index +[ERROR] cyclic package dependency: package `a v1.0.0 ([ROOT]/foo/a)` depends on itself. Cycle: +package `a v1.0.0 ([ROOT]/foo/a)` + ... which satisfies dependency `a = "^1.0"` of package `b v1.0.0 ([ROOT]/foo/b)` + ... which satisfies dependency `b = "^1.0"` of package `a v1.0.0 ([ROOT]/foo/a)` + +"#]]) .run(); } @@ -1797,12 +1805,11 @@ fn patch_same_version() { p.cargo("check") .with_status(101) - .with_stderr( - "\ -[UPDATING] [..] -error: cannot have two `[patch]` entries which both resolve to `bar v0.1.0` -", - ) + .with_stderr_data(str![[r#" +[UPDATING] git repository `[ROOTURL]/override` +[ERROR] cannot have two `[patch]` entries which both resolve to `bar v0.1.0` + +"#]]) .run(); } @@ -1851,14 +1858,14 @@ fn two_semver_compatible() { // building anything else. p.cargo("check").run(); p.cargo("check") - .with_stderr( - "\ -warning: Patch `bar v0.1.1 [..]` was not used in the crate graph. + .with_stderr_data(str![[r#" +[WARNING] Patch `bar v0.1.1 ([ROOTURL]/override#[..])` was not used in the crate graph. Perhaps you misspelled the source URL being patched. Possible URLs for `[patch.]`: - [CWD]/bar -[FINISHED] [..]", - ) + [ROOT]/foo/bar +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]) .run(); } @@ -1907,14 +1914,14 @@ fn multipatch_select_big() { // build succeeds again without updating anything or building anything else. p.cargo("check").run(); p.cargo("check") - .with_stderr( - "\ -warning: Patch `bar v0.1.0 [..]` was not used in the crate graph. + .with_stderr_data(str![[r#" +[WARNING] Patch `bar v0.1.0 ([ROOTURL]/override#[..])` was not used in the crate graph. Perhaps you misspelled the source URL being patched. Possible URLs for `[patch.]`: - [CWD]/bar -[FINISHED] [..]", - ) + [ROOT]/foo/bar +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]) .run(); } @@ -1981,8 +1988,18 @@ fn canonicalize_a_bunch() { // Then a few more times for good measure to ensure no weird warnings about // `[patch]` are printed. - p.cargo("check").with_stderr("[FINISHED] [..]").run(); - p.cargo("check").with_stderr("[FINISHED] [..]").run(); + p.cargo("check") + .with_stderr_data(str![[r#" +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]) + .run(); + p.cargo("check") + .with_stderr_data(str![[r#" +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]) + .run(); } #[cargo_test] @@ -2020,7 +2037,11 @@ fn update_unused_new_version() { .build(); p.cargo("check") - .with_stderr_contains("[WARNING] Patch `bar v0.1.4 [..] was not used in the crate graph.") + .with_stderr_data(str![[r#" +[UPDATING] `dummy-registry` index +[WARNING] Patch `bar v0.1.4 ([ROOT]/bar)` was not used in the crate graph. +... +"#]]) .run(); // unused patch should be in the lock file let lock = p.read_lockfile(); @@ -2040,19 +2061,23 @@ fn update_unused_new_version() { // Try to build again, this should automatically update Cargo.lock. p.cargo("check") - .with_stderr( - "\ + .with_stderr_data(str![[r#" [UPDATING] `dummy-registry` index [LOCKING] 1 package to latest compatible version [ADDING] bar v0.1.6 ([ROOT]/bar) -[CHECKING] bar v0.1.6 ([..]/bar) -[CHECKING] foo v0.0.1 ([..]/foo) -[FINISHED] [..] -", - ) +[CHECKING] bar v0.1.6 ([ROOT]/bar) +[CHECKING] foo v0.0.1 ([ROOT]/foo) +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]) .run(); // This should not update any registry. - p.cargo("check").with_stderr("[FINISHED] [..]").run(); + p.cargo("check") + .with_stderr_data(str![[r#" +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]) + .run(); assert!(!p.read_lockfile().contains("unused")); // Restore the lock file, and see if `update` will work, too. @@ -2060,27 +2085,25 @@ fn update_unused_new_version() { // Try `update `. p.cargo("update bar") - .with_stderr( - "\ + .with_stderr_data(str![[r#" [UPDATING] `dummy-registry` index [LOCKING] 1 package to latest compatible version -[ADDING] bar v0.1.6 ([..]/bar) +[ADDING] bar v0.1.6 ([ROOT]/bar) [REMOVING] bar v0.1.5 -", - ) + +"#]]) .run(); // Try with bare `cargo update`. fs::copy(p.root().join("Cargo.lock.bak"), p.root().join("Cargo.lock")).unwrap(); p.cargo("update") - .with_stderr( - "\ + .with_stderr_data(str![[r#" [UPDATING] `dummy-registry` index [LOCKING] 1 package to latest compatible version -[ADDING] bar v0.1.6 ([..]/bar) +[ADDING] bar v0.1.6 ([ROOT]/bar) [REMOVING] bar v0.1.5 -", - ) + +"#]]) .run(); } @@ -2114,8 +2137,7 @@ fn too_many_matches() { // Picks 0.1.1, the most recent version. p.cargo("check") .with_status(101) - .with_stderr( - "\ + .with_stderr_data(str![[r#" [UPDATING] `alternative` index [ERROR] failed to resolve patches for `https://github.com/rust-lang/crates.io-index` @@ -2126,9 +2148,9 @@ Caused by: patch for `bar` in `registry `alternative`` resolved to more than one candidate Found versions: 0.1.0, 0.1.1 Update the patch definition to select only one package. - For example, add an `=` version requirement to the patch definition, such as `version = \"=0.1.1\"`. -", - ) + For example, add an `=` version requirement to the patch definition, such as `version = "=0.1.1"`. + +"#]]) .run(); } @@ -2158,17 +2180,16 @@ fn no_matches() { p.cargo("check") .with_status(101) - .with_stderr( - "\ -error: failed to resolve patches for `https://github.com/rust-lang/crates.io-index` + .with_stderr_data(str![[r#" +[ERROR] failed to resolve patches for `https://github.com/rust-lang/crates.io-index` Caused by: patch for `bar` in `https://github.com/rust-lang/crates.io-index` failed to resolve Caused by: - The patch location `[..]/foo/bar` does not appear to contain any packages matching the name `bar`. -", - ) + The patch location `[ROOT]/foo/bar` does not appear to contain any packages matching the name `bar`. + +"#]]) .run(); } @@ -2198,20 +2219,17 @@ fn mismatched_version() { p.cargo("check") .with_status(101) - .with_stderr( - "\ + .with_stderr_data(str![[r#" [ERROR] failed to resolve patches for `https://github.com/rust-lang/crates.io-index` Caused by: patch for `bar` in `https://github.com/rust-lang/crates.io-index` failed to resolve Caused by: - The patch location `[..]/foo/bar` contains a `bar` package with version `0.1.0`, \ - but the patch definition requires `^0.1.1`. - Check that the version in the patch location is what you expect, \ - and update the patch definition to match. -", - ) + The patch location `[ROOT]/foo/bar` contains a `bar` package with version `0.1.0`, but the patch definition requires `^0.1.1`. + Check that the version in the patch location is what you expect, and update the patch definition to match. + +"#]]) .run(); } @@ -2242,31 +2260,29 @@ fn patch_walks_backwards() { .build(); p.cargo("check") - .with_stderr( - "\ + .with_stderr_data(str![[r#" [UPDATING] `dummy-registry` index [LOCKING] 2 packages to latest compatible versions -[CHECKING] bar v0.1.1 ([..]/foo/bar) -[CHECKING] foo v0.1.0 ([..]/foo) -[FINISHED] [..] -", - ) +[CHECKING] bar v0.1.1 ([ROOT]/foo/bar) +[CHECKING] foo v0.1.0 ([ROOT]/foo) +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]) .run(); // Somehow the user changes the version backwards. p.change_file("bar/Cargo.toml", &basic_manifest("bar", "0.1.0")); p.cargo("check") - .with_stderr( - "\ + .with_stderr_data(str![[r#" [UPDATING] `dummy-registry` index [LOCKING] 1 package to latest compatible version -[DOWNGRADING] bar v0.1.1 ([CWD]/bar) -> v0.1.0 -[CHECKING] bar v0.1.0 ([..]/foo/bar) -[CHECKING] foo v0.1.0 ([..]/foo) -[FINISHED] [..] -", - ) +[DOWNGRADING] bar v0.1.1 ([ROOT]/foo/bar) -> v0.1.0 +[CHECKING] bar v0.1.0 ([ROOT]/foo/bar) +[CHECKING] foo v0.1.0 ([ROOT]/foo) +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]) .run(); } @@ -2298,15 +2314,14 @@ fn patch_walks_backwards_restricted() { .build(); p.cargo("check") - .with_stderr( - "\ + .with_stderr_data(str![[r#" [UPDATING] `dummy-registry` index [LOCKING] 2 packages to latest compatible versions -[CHECKING] bar v0.1.1 ([..]/foo/bar) -[CHECKING] foo v0.1.0 ([..]/foo) -[FINISHED] [..] -", - ) +[CHECKING] bar v0.1.1 ([ROOT]/foo/bar) +[CHECKING] foo v0.1.0 ([ROOT]/foo) +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]) .run(); // Somehow the user changes the version backwards. @@ -2314,18 +2329,17 @@ fn patch_walks_backwards_restricted() { p.cargo("check") .with_status(101) - .with_stderr( - "\ -error: failed to resolve patches for `https://github.com/rust-lang/crates.io-index` + .with_stderr_data(str![[r#" +[ERROR] failed to resolve patches for `https://github.com/rust-lang/crates.io-index` Caused by: patch for `bar` in `https://github.com/rust-lang/crates.io-index` failed to resolve Caused by: - The patch location `[..]/foo/bar` contains a `bar` package with version `0.1.0`, but the patch definition requires `^0.1.1`. + The patch location `[ROOT]/foo/bar` contains a `bar` package with version `0.1.0`, but the patch definition requires `^0.1.1`. Check that the version in the patch location is what you expect, and update the patch definition to match. -", - ) + +"#]]) .run(); } @@ -2371,24 +2385,28 @@ fn patched_dep_new_version() { // Lock everything. p.cargo("check") - .with_stderr( - "\ + .with_stderr_data(str![[r#" [UPDATING] `dummy-registry` index [LOCKING] 3 packages to latest compatible versions [DOWNLOADING] crates ... -[DOWNLOADED] baz v0.1.0 [..] +[DOWNLOADED] baz v0.1.0 (registry `dummy-registry`) [CHECKING] baz v0.1.0 -[CHECKING] bar v0.1.0 ([..]/foo/bar) -[CHECKING] foo v0.1.0 ([..]/foo) -[FINISHED] [..] -", - ) +[CHECKING] bar v0.1.0 ([ROOT]/foo/bar) +[CHECKING] foo v0.1.0 ([ROOT]/foo) +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]) .run(); Package::new("baz", "0.1.1").publish(); // Just the presence of the new version should not have changed anything. - p.cargo("check").with_stderr("[FINISHED] [..]").run(); + p.cargo("check") + .with_stderr_data(str![[r#" +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]) + .run(); // Modify the patch so it requires the new version. p.change_file( @@ -2406,19 +2424,18 @@ fn patched_dep_new_version() { // Should unlock and update cleanly. p.cargo("check") - .with_stderr( - "\ + .with_stderr_data(str![[r#" [UPDATING] `dummy-registry` index [LOCKING] 1 package to latest compatible version [UPDATING] baz v0.1.0 -> v0.1.1 [DOWNLOADING] crates ... [DOWNLOADED] baz v0.1.1 (registry `dummy-registry`) [CHECKING] baz v0.1.1 -[CHECKING] bar v0.1.0 ([..]/foo/bar) -[CHECKING] foo v0.1.0 ([..]/foo) -[FINISHED] [..] -", - ) +[CHECKING] bar v0.1.0 ([ROOT]/foo/bar) +[CHECKING] foo v0.1.0 ([ROOT]/foo) +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]) .run(); } @@ -2453,18 +2470,20 @@ fn patch_update_doesnt_update_other_sources() { .build(); p.cargo("check") - .with_stderr_unordered( - "\ + .with_stderr_data( + str![[r#" [UPDATING] `dummy-registry` index [UPDATING] `alternative` index [LOCKING] 3 packages to latest compatible versions [DOWNLOADING] crates ... [DOWNLOADED] bar v0.1.0 (registry `alternative`) +[CHECKING] bar v0.1.0 ([ROOT]/foo/bar) [CHECKING] bar v0.1.0 (registry `alternative`) -[CHECKING] bar v0.1.0 ([..]/foo/bar) -[CHECKING] foo v0.1.0 ([..]/foo) -[FINISHED] [..] -", +[CHECKING] foo v0.1.0 ([ROOT]/foo) +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]] + .unordered(), ) .run(); @@ -2473,23 +2492,27 @@ fn patch_update_doesnt_update_other_sources() { Package::new("bar", "0.1.1").alternative(true).publish(); // Since it is locked, nothing should change. - p.cargo("check").with_stderr("[FINISHED] [..]").run(); + p.cargo("check") + .with_stderr_data(str![[r#" +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]) + .run(); // Require new version on crates.io. p.change_file("bar/Cargo.toml", &basic_manifest("bar", "0.1.1")); // This should not update bar_alt. p.cargo("check") - .with_stderr( - "\ + .with_stderr_data(str![[r#" [UPDATING] `dummy-registry` index [LOCKING] 1 package to latest compatible version -[UPDATING] bar v0.1.0 ([CWD]/bar) -> v0.1.1 -[CHECKING] bar v0.1.1 ([..]/foo/bar) -[CHECKING] foo v0.1.0 ([..]/foo) -[FINISHED] [..] -", - ) +[UPDATING] bar v0.1.0 ([ROOT]/foo/bar) -> v0.1.1 +[CHECKING] bar v0.1.1 ([ROOT]/foo/bar) +[CHECKING] foo v0.1.0 ([ROOT]/foo) +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]) .run(); } @@ -2521,35 +2544,38 @@ fn can_update_with_alt_reg() { .build(); p.cargo("check") - .with_stderr( - "\ + .with_stderr_data(str![[r#" [UPDATING] `alternative` index [UPDATING] `dummy-registry` index [LOCKING] 2 packages to latest compatible versions [DOWNLOADING] crates ... [DOWNLOADED] bar v0.1.1 (registry `alternative`) [CHECKING] bar v0.1.1 (registry `alternative`) -[CHECKING] foo v0.1.0 ([..]/foo) -[FINISHED] [..] -", - ) +[CHECKING] foo v0.1.0 ([ROOT]/foo) +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]) .run(); Package::new("bar", "0.1.2").alternative(true).publish(); // Should remain locked. - p.cargo("check").with_stderr("[FINISHED] [..]").run(); + p.cargo("check") + .with_stderr_data(str![[r#" +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]) + .run(); // This does nothing, due to `=` requirement. p.cargo("update bar") - .with_stderr( - "\ + .with_stderr_data(str![[r#" [UPDATING] `alternative` index [UPDATING] `dummy-registry` index [LOCKING] 0 packages to latest compatible versions [NOTE] pass `--verbose` to see 1 unchanged dependencies behind latest -", - ) + +"#]]) .run(); // Bump to 0.1.2. @@ -2570,8 +2596,7 @@ fn can_update_with_alt_reg() { ); p.cargo("check") - .with_stderr( - "\ + .with_stderr_data(str![[r#" [UPDATING] `alternative` index [UPDATING] `dummy-registry` index [LOCKING] 1 package to latest compatible version @@ -2579,10 +2604,10 @@ fn can_update_with_alt_reg() { [DOWNLOADING] crates ... [DOWNLOADED] bar v0.1.2 (registry `alternative`) [CHECKING] bar v0.1.2 (registry `alternative`) -[CHECKING] foo v0.1.0 ([..]/foo) -[FINISHED] [..] -", - ) +[CHECKING] foo v0.1.0 ([ROOT]/foo) +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]) .run(); } @@ -2661,18 +2686,18 @@ dependencies = [ } cargo // .env("CARGO_LOG", "trace") - .with_stderr( + .with_stderr_data( "\ -[UPDATING] [..] +[UPDATING] git repository `[ROOTURL]/bar` [LOCKING] 1 package to latest compatible version -[ADDING] bar v1.0.0 (file://[..]) +[ADDING] bar v1.0.0 ([ROOTURL]/bar?branch=master#[..]) ", ) // .with_status(1) - .with_stdout(format!( + .with_stdout_data(format!( "\ -foo v0.1.0 [..] -└── bar v1.0.0 (file:///[..]branch=master#{}) +foo v0.1.0 ([ROOT]/foo) +└── bar v1.0.0 ([ROOTURL]/bar?branch=master#{}) ", &bar_oid.to_string()[..8] )) @@ -2715,20 +2740,20 @@ fn patch_eq_conflict_panic() { p.cargo("generate-lockfile") .with_status(101) - .with_stderr( - r#"[UPDATING] `dummy-registry` index + .with_stderr_data(str![[r#" +[UPDATING] `dummy-registry` index [ERROR] failed to select a version for `bar`. - ... required by package `foo v0.1.0 ([..])` + ... required by package `foo v0.1.0 ([ROOT]/foo)` versions that meet the requirements `=0.1.1` are: 0.1.1 all possible versions conflict with previously selected packages. previously selected package `bar v0.1.0` - ... which satisfies dependency `bar = "=0.1.0"` of package `foo v0.1.0 ([..])` + ... which satisfies dependency `bar = "=0.1.0"` of package `foo v0.1.0 ([ROOT]/foo)` failed to select a version for `bar` which could resolve this conflict -"#, - ) + +"#]]) .run(); } @@ -2772,20 +2797,21 @@ fn mismatched_version2() { p.cargo("generate-lockfile") .with_status(101) - .with_stderr( - r#"[UPDATING] `dummy-registry` index + .with_stderr_data(str![[r#" +[UPDATING] `dummy-registry` index [ERROR] failed to select a version for `qux`. ... required by package `bar v0.1.0` - ... which satisfies dependency `bar = "^0.1.0"` of package `foo v0.1.0 ([..])` + ... which satisfies dependency `bar = "^0.1.0"` of package `foo v0.1.0 ([ROOT]/foo)` versions that meet the requirements `=0.1.0-beta.1` are: 0.1.0-beta.1 all possible versions conflict with previously selected packages. previously selected package `qux v0.1.0-beta.2` - ... which satisfies dependency `qux = "^0.1.0-beta.2"` of package `foo v0.1.0 ([..])` + ... which satisfies dependency `qux = "^0.1.0-beta.2"` of package `foo v0.1.0 ([ROOT]/foo)` -failed to select a version for `qux` which could resolve this conflict"#, - ) +failed to select a version for `qux` which could resolve this conflict + +"#]]) .run(); } @@ -2819,16 +2845,17 @@ fn mismatched_version_with_prerelease() { p.cargo("generate-lockfile") .with_status(101) - .with_stderr( - r#"[UPDATING] `dummy-registry` index + .with_stderr_data(str![[r#" +[UPDATING] `dummy-registry` index [ERROR] failed to select a version for the requirement `prerelease-deps = "^0.1.0"` candidate versions found which didn't match: 0.1.1-pre1, 0.0.1 location searched: `dummy-registry` index (which is replacing registry `crates-io`) -required by package `foo v0.1.0 [..]` +required by package `foo v0.1.0 ([ROOT]/foo)` if you are looking for the prerelease package it needs to be specified explicitly prerelease-deps = { version = "0.1.1-pre1" } -perhaps a crate was updated and forgotten to be re-vendored?"#, - ) +perhaps a crate was updated and forgotten to be re-vendored? + +"#]]) .run(); } @@ -2864,14 +2891,13 @@ fn from_config_empty() { p.cargo("check") .with_status(101) - .with_stderr( - "\ + .with_stderr_data(str![[r#" [ERROR] [patch] entry `` should be a URL or registry name Caused by: invalid url ``: relative URL without a base -", - ) + +"#]]) .run(); } @@ -2903,17 +2929,16 @@ fn from_manifest_empty() { p.cargo("check") .with_status(101) - .with_stderr( - "\ -[ERROR] failed to parse manifest at `[CWD]/Cargo.toml` + .with_stderr_data(str![[r#" +[ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml` Caused by: [patch] entry `` should be a URL or registry name Caused by: invalid url ``: relative URL without a base -", - ) + +"#]]) .run(); } @@ -2972,15 +2997,14 @@ fn patched_reexport_stays_locked() { .build(); p.cargo("tree") - .with_stdout( - "\ + .with_stdout_data(str![[r#" foo v0.0.0 ([ROOT]/foo) ├── bar v1.0.999 ([ROOT]/foo/bar-1-as-3) │ └── bar v3.0.0 └── bar v2.0.999 ([ROOT]/foo/bar-2-as-3) └── bar v3.0.0 -", - ) + +"#]]) .run(); std::fs::copy( @@ -2991,15 +3015,14 @@ foo v0.0.0 ([ROOT]/foo) Package::new("bar", "3.0.1").publish(); p.cargo("tree") - .with_stdout( - "\ + .with_stdout_data(str![[r#" foo v0.0.0 ([ROOT]/foo) ├── bar v1.0.999 ([ROOT]/foo/bar-1-as-3) │ └── bar v3.0.0 └── bar v2.0.999 ([ROOT]/foo/bar-2-as-3) └── bar v3.0.0 -", - ) + +"#]]) .run(); assert_eq!(p.read_file("Cargo.lock"), p.read_file("Cargo.lock.orig")); diff --git a/tests/testsuite/pkgid.rs b/tests/testsuite/pkgid.rs index 339a7b87f63..a1729a94368 100644 --- a/tests/testsuite/pkgid.rs +++ b/tests/testsuite/pkgid.rs @@ -1,10 +1,9 @@ //! 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; +use cargo_test_support::prelude::*; use cargo_test_support::project; use cargo_test_support::registry::Package; use cargo_test_support::str; @@ -40,38 +39,36 @@ fn local() { p.cargo("generate-lockfile").run(); p.cargo("pkgid foo") - .with_stdout(format!( - "path+file://[..]{}#0.1.0", - p.root().to_str().unwrap() - )) + .with_stdout_data(str![[r#" +path+[ROOTURL]/foo#0.1.0 + +"#]]) .run(); // Bad file URL. p.cargo("pkgid ./Cargo.toml") .with_status(101) - .with_stderr( - "\ -error: invalid package ID specification: `./Cargo.toml` + .with_stderr_data(str![[r#" +[ERROR] invalid package ID specification: `./Cargo.toml` Caused by: - package ID specification `./Cargo.toml` looks like a file path, maybe try file://[..]/Cargo.toml -", - ) + package ID specification `./Cargo.toml` looks like a file path, maybe try [ROOTURL]/foo/Cargo.toml + +"#]]) .run(); // Bad file URL with similar name. p.cargo("pkgid './bar'") .with_status(101) - .with_stderr( - "\ -error: invalid package ID specification: `./bar` + .with_stderr_data(str![[r#" +[ERROR] invalid package ID specification: `./bar` -Did you mean `bar`? + Did you mean `bar`? Caused by: - package ID specification `./bar` looks like a file path, maybe try file://[..]/bar -", - ) + package ID specification `./bar` looks like a file path, maybe try [ROOTURL]/foo/bar + +"#]]) .run(); } @@ -98,32 +95,33 @@ fn registry() { p.cargo("generate-lockfile").run(); p.cargo("pkgid crates-io") - .with_stdout("registry+https://github.com/rust-lang/crates.io-index#crates-io@0.1.0") + .with_stdout_data(str![[r#" +registry+https://github.com/rust-lang/crates.io-index#crates-io@0.1.0 + +"#]]) .run(); // Bad URL. p.cargo("pkgid https://example.com/crates-io") .with_status(101) - .with_stderr( - "\ -error: package ID specification `https://example.com/crates-io` did not match any packages + .with_stderr_data(str![[r#" +[ERROR] package ID specification `https://example.com/crates-io` did not match any packages Did you mean one of these? crates-io@0.1.0 -", - ) + +"#]]) .run(); // Bad name. p.cargo("pkgid crates_io") .with_status(101) - .with_stderr( - "\ -error: package ID specification `crates_io` did not match any packages + .with_stderr_data(str![[r#" +[ERROR] package ID specification `crates_io` did not match any packages -Did you mean `crates-io`? -", - ) + Did you mean `crates-io`? + +"#]]) .run(); } @@ -152,56 +150,55 @@ fn multiple_versions() { p.cargo("generate-lockfile").run(); p.cargo("pkgid two-ver:0.2.0") - .with_stdout("registry+https://github.com/rust-lang/crates.io-index#two-ver@0.2.0") + .with_stdout_data(str![[r#" +registry+https://github.com/rust-lang/crates.io-index#two-ver@0.2.0 + +"#]]) .run(); // Incomplete version. p.cargo("pkgid two-ver@0") .with_status(101) - .with_stderr( - "\ -error: There are multiple `two-ver` packages in your project, and the specification `two-ver@0` is ambiguous. + .with_stderr_data(str![[r#" +[ERROR] There are multiple `two-ver` packages in your project, and the specification `two-ver@0` is ambiguous. Please re-run this command with one of the following specifications: two-ver@0.1.0 two-ver@0.2.0 -", - ) + +"#]]) .run(); // Incomplete version. p.cargo("pkgid two-ver@0.2") - .with_stdout( - "\ + .with_stdout_data(str![[r#" registry+https://github.com/rust-lang/crates.io-index#two-ver@0.2.0 -", - ) + +"#]]) .run(); // Ambiguous. p.cargo("pkgid two-ver") .with_status(101) - .with_stderr( - "\ -error: There are multiple `two-ver` packages in your project, and the specification `two-ver` is ambiguous. + .with_stderr_data(str![[r#" +[ERROR] There are multiple `two-ver` packages in your project, and the specification `two-ver` is ambiguous. Please re-run this command with one of the following specifications: two-ver@0.1.0 two-ver@0.2.0 -", - ) + +"#]]) .run(); // Bad version. p.cargo("pkgid two-ver:0.3.0") .with_status(101) - .with_stderr( - "\ -error: package ID specification `two-ver@0.3.0` did not match any packages + .with_stderr_data(str![[r#" +[ERROR] package ID specification `two-ver@0.3.0` did not match any packages Did you mean one of these? two-ver@0.1.0 two-ver@0.2.0 -", - ) + +"#]]) .run(); } @@ -260,12 +257,12 @@ fn multiple_git_same_version() { p.cargo("check").run(); p.cargo("tree") - .with_stdout(&format!( + .with_stdout_data(&format!( "\ -foo v0.1.0 ([..]/foo) -├── bar v0.1.0 ([..]/foo/bar) -│ └── xyz v0.5.0 (file://[..]/xyz?rev={}#{}) -└── xyz v0.5.0 (file://[..]/xyz?rev={}#{}) +foo v0.1.0 ([ROOT]/foo) +├── bar v0.1.0 ([ROOT]/foo/bar) +│ └── xyz v0.5.0 ([ROOTURL]/xyz?rev={}#{}) +└── xyz v0.5.0 ([ROOTURL]/xyz?rev={}#{}) ", rev2, &rev2.to_string()[..8], @@ -277,14 +274,13 @@ foo v0.1.0 ([..]/foo) // possible pkgids are also ambiguous. p.cargo("pkgid xyz") .with_status(101) - .with_stderr( - "\ -error: There are multiple `xyz` packages in your project, and the specification `xyz` is ambiguous. + .with_stderr_data(str![[r#" +[ERROR] There are multiple `xyz` packages in your project, and the specification `xyz` is ambiguous. Please re-run this command with one of the following specifications: - git+file://[..]/xyz?rev=[..]#0.5.0 - git+file://[..]/xyz?rev=[..]#0.5.0 -", - ) + git+[ROOTURL]/xyz?rev=[..]#0.5.0 + git+[ROOTURL]/xyz?rev=[..]#0.5.0 + +"#]]) .run(); // TODO, what should the `-p` value be here? //p.cargo("update -p") @@ -310,6 +306,7 @@ fn pkgid_json_message_metadata_consistency() { let pkgid = pkgid.trim(); assert_e2e().eq(pkgid, str!["path+[ROOTURL]/foo#0.5.0"]); + #[allow(deprecated)] p.cargo("check --message-format=json") .with_json( &r#" @@ -373,13 +370,15 @@ fn pkgid_json_message_metadata_consistency() { .run(); p.cargo("metadata") - .with_json( - &r#" + .with_stdout_data( + str![[r#" { "metadata": null, "packages": [ { - "authors": "{...}", + "authors": [ + "wycats@example.com" + ], "categories": [], "default_run": null, "dependencies": [], @@ -388,12 +387,12 @@ fn pkgid_json_message_metadata_consistency() { "edition": "2015", "features": {}, "homepage": null, - "id": "$PKGID", + "id": "path+[ROOTURL]/foo#0.5.0", "keywords": [], "license": null, "license_file": null, "links": null, - "manifest_path": "[..]", + "manifest_path": "[ROOT]/foo/Cargo.toml", "metadata": null, "name": "foo", "publish": null, @@ -411,23 +410,23 @@ fn pkgid_json_message_metadata_consistency() { "dependencies": [], "deps": [], "features": [], - "id": "$PKGID" + "id": "path+[ROOTURL]/foo#0.5.0" } ], - "root": "$PKGID" + "root": "path+[ROOTURL]/foo#0.5.0" }, - "target_directory": "[..]", + "target_directory": "[ROOT]/foo/target", "version": 1, "workspace_default_members": [ - "$PKGID" + "path+[ROOTURL]/foo#0.5.0" ], "workspace_members": [ - "$PKGID" + "path+[ROOTURL]/foo#0.5.0" ], - "workspace_root": "[..]" + "workspace_root": "[ROOT]/foo" } - "# - .replace("$PKGID", pkgid), +"#]] + .json(), ) .run() } diff --git a/tests/testsuite/proc_macro.rs b/tests/testsuite/proc_macro.rs index 9db2f6362e3..216cdb9dae2 100644 --- a/tests/testsuite/proc_macro.rs +++ b/tests/testsuite/proc_macro.rs @@ -1,8 +1,8 @@ //! Tests for proc-macros. -#![allow(deprecated)] - +use cargo_test_support::prelude::*; use cargo_test_support::project; +use cargo_test_support::str; #[cargo_test] fn probe_cfg_before_crate_type_discovery() { @@ -207,7 +207,12 @@ fn impl_and_derive() { .build(); p.cargo("build").run(); - p.cargo("run").with_stdout("X { success: true }").run(); + p.cargo("run") + .with_stdout_data(str![[r#" +X { success: true } + +"#]]) + .run(); } #[cargo_test] @@ -251,8 +256,21 @@ fn proc_macro_doctest() { .build(); foo.cargo("test") - .with_stdout_contains("test a ... ok") - .with_stdout_contains_n("test [..] ... ok", 2) + .with_stdout_data(str![[r#" + +running 1 test +test a ... ok + +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in [ELAPSED]s + + +running 1 test +test src/lib.rs - derive (line 8) ... ok + +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in [ELAPSED]s + + +"#]]) .run(); } @@ -319,8 +337,21 @@ fn proc_macro_crate_type() { .build(); foo.cargo("test") - .with_stdout_contains("test tests::it_works ... ok") - .with_stdout_contains_n("test [..] ... ok", 2) + .with_stdout_data(str![[r#" + +running 1 test +test tests::it_works ... ok + +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in [ELAPSED]s + + +running 1 test +test src/lib.rs - (line 2) ... ok + +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in [ELAPSED]s + + +"#]]) .run(); } @@ -342,8 +373,12 @@ fn proc_macro_crate_type_warning() { .build(); foo.cargo("check") - .with_stderr_contains( - "[WARNING] library `foo` should only specify `proc-macro = true` instead of setting `crate-type`") + .with_stderr_data(str![[r#" +[WARNING] library `foo` should only specify `proc-macro = true` instead of setting `crate-type` +[CHECKING] foo v0.1.0 ([ROOT]/foo) +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]) .run(); } @@ -365,7 +400,12 @@ fn lib_plugin_unused_key_warning() { .build(); foo.cargo("check") - .with_stderr_contains("[WARNING] unused manifest key: lib.plugin") + .with_stderr_data(str![[r#" +[WARNING] unused manifest key: lib.plugin +[CHECKING] foo v0.1.0 ([ROOT]/foo) +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]) .run(); } @@ -387,9 +427,13 @@ fn proc_macro_crate_type_warning_plugin() { .build(); foo.cargo("check") - .with_stderr_contains( - "[WARNING] library `foo` should only specify `proc-macro = true` instead of setting `crate-type`") - .run(); + .with_stderr_data(str![[r#" +[WARNING] library `foo` should only specify `proc-macro = true` instead of setting `crate-type` +[CHECKING] foo v0.1.0 ([ROOT]/foo) +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]]) + .run(); } #[cargo_test] @@ -410,14 +454,13 @@ fn proc_macro_crate_type_multiple() { .build(); foo.cargo("check") - .with_stderr( - "\ -[ERROR] failed to parse manifest at `[..]/foo/Cargo.toml` + .with_stderr_data(str![[r#" +[ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml` Caused by: cannot mix `proc-macro` crate type with others -", - ) + +"#]]) .with_status(101) .run(); } @@ -508,19 +551,21 @@ fn proc_macro_built_once() { .file("the-macro/src/lib.rs", "") .build(); p.cargo("build --verbose") - .with_stderr_unordered( - "\ + .with_stderr_data( + str![[r#" [LOCKING] 3 packages to latest compatible versions -[COMPILING] the-macro [..] +[COMPILING] the-macro v0.1.0 ([ROOT]/foo/the-macro) [RUNNING] `rustc --crate-name the_macro [..]` -[COMPILING] b [..] +[COMPILING] b v0.1.0 ([ROOT]/foo/b) [RUNNING] `rustc --crate-name b [..]` -[COMPILING] a [..] +[COMPILING] a v0.1.0 ([ROOT]/foo/a) [RUNNING] `rustc --crate-name build_script_build [..]` -[RUNNING] `[..]build[..]script[..]build[..]` +[RUNNING] `[ROOT]/foo/target/debug/build/a-[HASH]/build-script-build` [RUNNING] `rustc --crate-name a [..]` -[FINISHED] [..] -", +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s + +"#]] + .unordered(), ) .run(); } diff --git a/tests/testsuite/progress.rs b/tests/testsuite/progress.rs index e68cf580a05..cfc85eb0a50 100644 --- a/tests/testsuite/progress.rs +++ b/tests/testsuite/progress.rs @@ -1,9 +1,9 @@ //! Tests for progress bar. -#![allow(deprecated)] - +use cargo_test_support::prelude::*; use cargo_test_support::project; use cargo_test_support::registry::Package; +use cargo_test_support::str; #[cargo_test] fn bad_progress_config_unknown_when() { @@ -20,15 +20,13 @@ fn bad_progress_config_unknown_when() { p.cargo("check") .with_status(101) - .with_stderr( - "\ -[ERROR] error in [..].cargo/config.toml: \ -could not load config key `term.progress.when` + .with_stderr_data(str![[r#" +[ERROR] error in [ROOT]/foo/.cargo/config.toml: could not load config key `term.progress.when` Caused by: unknown variant `unknown`, expected one of `auto`, `never`, `always` -", - ) + +"#]]) .run(); } @@ -47,11 +45,10 @@ fn bad_progress_config_missing_width() { p.cargo("check") .with_status(101) - .with_stderr( - "\ -[ERROR] \"always\" progress requires a `width` key -", - ) + .with_stderr_data(str![[r#" +[ERROR] "always" progress requires a `width` key + +"#]]) .run(); } @@ -70,14 +67,13 @@ fn bad_progress_config_missing_when() { p.cargo("check") .with_status(101) - .with_stderr( - "\ -error: error in [..]: could not load config key `term.progress` + .with_stderr_data(str![[r#" +[ERROR] error in [ROOT]/foo/.cargo/config.toml: could not load config key `term.progress` Caused by: missing field `when` -", - ) + +"#]]) .run(); } @@ -116,12 +112,23 @@ fn always_shows_progress() { .build(); p.cargo("check") - .with_stderr_contains("[DOWNLOADING] [..] crates [..]") - .with_stderr_contains("[..][DOWNLOADED] 3 crates ([..]) in [..]") - .with_stderr_contains("[BUILDING] [..] [..]/4: [..]") + .with_stderr_data( + str![[r#" +[DOWNLOADING] 1 crate +[DOWNLOADING] 2 crates +[DOWNLOADING] 3 crates +[DOWNLOADED] 3 crates ([..]KB) in [..]s +[BUILDING] [..] 0/4: [..] +[BUILDING] [..] 3/4: foo +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s +... +"#]] + .unordered(), + ) .run(); } +#[allow(deprecated)] #[cargo_test] fn never_progress() { const N: usize = 3;