From f031cccead7da57327c2e238d4addaa667121937 Mon Sep 17 00:00:00 2001 From: eth3lbert Date: Wed, 3 Jul 2024 08:44:41 +0800 Subject: [PATCH] test: migrate patch to snapbox --- tests/testsuite/patch.rs | 1059 +++++++++++++++++++------------------- 1 file changed, 541 insertions(+), 518 deletions(-) diff --git a/tests/testsuite/patch.rs b/tests/testsuite/patch.rs index 4872d822f..417773bf8 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"));