From 2c517d98588bee9832942572154f6f18b8644074 Mon Sep 17 00:00:00 2001 From: Heng-Yi Wu <2316687+henry40408@users.noreply.github.com> Date: Tue, 18 Jun 2024 05:48:21 +0800 Subject: [PATCH] test: migrate testsuite version to snapbox --- tests/testsuite/version.rs | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/tests/testsuite/version.rs b/tests/testsuite/version.rs index 008f15db6b9..f9e49a64dda 100644 --- a/tests/testsuite/version.rs +++ b/tests/testsuite/version.rs @@ -1,7 +1,5 @@ //! Tests for displaying the cargo version. -#![allow(deprecated)] - use cargo_test_support::{cargo_process, project}; #[cargo_test] @@ -9,15 +7,15 @@ fn simple() { let p = project().build(); p.cargo("version") - .with_stdout(&format!("cargo {}\n", cargo::version())) + .with_stdout_data(&format!("cargo {}\n", cargo::version())) .run(); p.cargo("--version") - .with_stdout(&format!("cargo {}\n", cargo::version())) + .with_stdout_data(&format!("cargo {}\n", cargo::version())) .run(); p.cargo("-V") - .with_stdout(&format!("cargo {}\n", cargo::version())) + .with_stdout_data(&format!("cargo {}\n", cargo::version())) .run(); } @@ -53,10 +51,19 @@ fn version_works_with_bad_target_dir() { fn verbose() { // This is mainly to check that it doesn't explode. cargo_process("-vV") - .with_stdout_contains(&format!("cargo {}", cargo::version())) - .with_stdout_contains("host: [..]") - .with_stdout_contains("libgit2: [..]") - .with_stdout_contains("libcurl: [..]") - .with_stdout_contains("os: [..]") + .with_stdout_data(format!( + "\ +cargo {} +release: [..] +commit-hash: [..] +commit-date: [..] +host: [HOST_TARGET] +libgit2: [..] (sys:[..] [..]) +libcurl: [..] (sys:[..] [..]) +... +os: [..] +", + cargo::version() + )) .run(); }