From 0290ea0996a228b2e0df1e7d2332d0a99a058b8e Mon Sep 17 00:00:00 2001 From: eth3lbert Date: Tue, 25 Jun 2024 14:57:52 +0800 Subject: [PATCH] test: migrate owner to snapbox --- tests/testsuite/owner.rs | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/tests/testsuite/owner.rs b/tests/testsuite/owner.rs index 251961169d6..e8b0370a439 100644 --- a/tests/testsuite/owner.rs +++ b/tests/testsuite/owner.rs @@ -1,12 +1,11 @@ //! Tests for the `cargo owner` command. -#![allow(deprecated)] - use std::fs; use cargo_test_support::paths::CargoPathExt; use cargo_test_support::project; use cargo_test_support::registry::{self, api_path}; +use cargo_test_support::str; fn setup(name: &str, content: Option<&str>) { let dir = api_path().join(format!("api/v1/crates/{}", name)); @@ -51,12 +50,11 @@ fn simple_list() { p.cargo("owner -l") .replace_crates_io(registry.index_url()) - .with_stdout( - "\ + .with_stdout_data(str![[r#" github:rust-lang:core (Core) octocat -", - ) + +"#]]) .run(); } @@ -83,13 +81,14 @@ fn simple_add() { p.cargo("owner -a username") .replace_crates_io(registry.index_url()) .with_status(101) - .with_stderr( - " Updating crates.io index -error: failed to invite owners to crate `foo` on registry at file://[..] + .with_stderr_data(str![[r#" +[UPDATING] crates.io index +[ERROR] failed to invite owners to crate `foo` on registry at [ROOTURL]/api Caused by: - EOF while parsing a value at line 1 column 0", - ) + EOF while parsing a value at line 1 column 0 + +"#]]) .run(); } @@ -149,14 +148,15 @@ fn simple_remove() { p.cargo("owner -r username") .replace_crates_io(registry.index_url()) .with_status(101) - .with_stderr( - " Updating crates.io index - Owner removing [\"username\"] from crate foo -error: failed to remove owners from crate `foo` on registry at file://[..] + .with_stderr_data(str![[r#" +[UPDATING] crates.io index +[OWNER] removing ["username"] from crate foo +[ERROR] failed to remove owners from crate `foo` on registry at [ROOTURL]/api Caused by: - EOF while parsing a value at line 1 column 0", - ) + EOF while parsing a value at line 1 column 0 + +"#]]) .run(); }