From 7a6bf16153f14a6ffb8bd4d5278c829c31fb404c Mon Sep 17 00:00:00 2001 From: eth3lbert Date: Tue, 9 Jul 2024 08:13:22 +0800 Subject: [PATCH] test: migrate fetch to snapbox --- tests/testsuite/fetch.rs | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/tests/testsuite/fetch.rs b/tests/testsuite/fetch.rs index 194943dde..2e1475a98 100644 --- a/tests/testsuite/fetch.rs +++ b/tests/testsuite/fetch.rs @@ -1,11 +1,9 @@ //! Tests for the `cargo fetch` command. -#![allow(deprecated)] - use cargo_test_support::prelude::*; use cargo_test_support::registry::Package; use cargo_test_support::rustc_host; -use cargo_test_support::{basic_manifest, cross_compile, project}; +use cargo_test_support::{basic_manifest, cross_compile, project, str}; #[cargo_test] fn no_deps() { @@ -14,7 +12,7 @@ fn no_deps() { .file("src/a.rs", "") .build(); - p.cargo("fetch").with_stderr("").run(); + p.cargo("fetch").with_stderr_data("").run(); } #[cargo_test] @@ -60,11 +58,16 @@ fn fetch_all_platform_dependencies_when_no_target_is_given() { .build(); p.cargo("fetch") - .with_stderr_contains("[DOWNLOADED] d1 v1.2.3 [..]") - .with_stderr_contains("[DOWNLOADED] d2 v0.1.2 [..]") + .with_stderr_data(str![[r#" +... +[DOWNLOADED] d1 v1.2.3 (registry `dummy-registry`) +[DOWNLOADED] d2 v0.1.2 (registry `dummy-registry`) +... +"#]]) .run(); } +#[allow(deprecated)] #[cargo_test] fn fetch_platform_specific_dependencies() { if cross_compile::disabled() { @@ -136,6 +139,9 @@ fn fetch_warning() { .file("src/lib.rs", "") .build(); p.cargo("fetch") - .with_stderr("[WARNING] unused manifest key: package.misspelled") + .with_stderr_data(str![[r#" +[WARNING] unused manifest key: package.misspelled + +"#]]) .run(); }