From 88ac4aaf2eb174e5217d0c1de6082914bdc6f950 Mon Sep 17 00:00:00 2001 From: Weihang Lo Date: Tue, 7 May 2024 14:19:29 -0400 Subject: [PATCH] test: switch to `assert_match_exact` There is no need to provide additional messages here. --- tests/testsuite/artifact_dep.rs | 60 ++++++++------------------------- 1 file changed, 14 insertions(+), 46 deletions(-) diff --git a/tests/testsuite/artifact_dep.rs b/tests/testsuite/artifact_dep.rs index d4b7d6cf576..7194b4a61f6 100644 --- a/tests/testsuite/artifact_dep.rs +++ b/tests/testsuite/artifact_dep.rs @@ -1,7 +1,7 @@ //! Tests specific to artifact dependencies, designated using //! the new `dep = { artifact = "bin", … }` syntax in manifests. -use cargo_test_support::compare::match_exact; +use cargo_test_support::compare; use cargo_test_support::registry::{Package, RegistryBuilder}; use cargo_test_support::{ basic_bin_manifest, basic_manifest, cross_compile, project, publish, registry, rustc_host, @@ -593,9 +593,9 @@ fn build_script_with_bin_artifacts() { .run(); let build_script_output = build_script_output_string(&p, "foo"); - let msg = "we need the binary directory for this artifact along with all binary paths"; + // we need the binary directory for this artifact along with all binary paths if cfg!(target_env = "msvc") { - match_exact( + compare::assert_match_exact( "[..]/artifact/bar-[..]/bin/baz.exe\n\ [..]/artifact/bar-[..]/staticlib/bar-[..].lib\n\ [..]/artifact/bar-[..]/cdylib/bar.dll\n\ @@ -603,13 +603,9 @@ fn build_script_with_bin_artifacts() { [..]/artifact/bar-[..]/bin/bar.exe\n\ [..]/artifact/bar-[..]/bin/bar.exe", &build_script_output, - msg, - "", - None, ) - .unwrap(); } else { - match_exact( + compare::assert_match_exact( "[..]/artifact/bar-[..]/bin/baz-[..]\n\ [..]/artifact/bar-[..]/staticlib/libbar-[..].a\n\ [..]/artifact/bar-[..]/cdylib/[..]bar.[..]\n\ @@ -617,11 +613,7 @@ fn build_script_with_bin_artifacts() { [..]/artifact/bar-[..]/bin/bar-[..]\n\ [..]/artifact/bar-[..]/bin/bar-[..]", &build_script_output, - msg, - "", - None, ) - .unwrap(); } assert!( @@ -783,31 +775,22 @@ fn build_script_with_selected_dashed_bin_artifact_and_lib_true() { .run(); let build_script_output = build_script_output_string(&p, "foo"); - let msg = "we need the binary directory for this artifact and the binary itself"; - + // we need the binary directory for this artifact and the binary itself if cfg!(target_env = "msvc") { - cargo_test_support::compare::match_exact( + compare::assert_match_exact( &format!( "[..]/artifact/bar-baz-[..]/bin\n\ [..]/artifact/bar-baz-[..]/bin/baz_suffix{}", std::env::consts::EXE_SUFFIX, ), &build_script_output, - msg, - "", - None, - ) - .unwrap(); + ); } else { - cargo_test_support::compare::match_exact( + compare::assert_match_exact( "[..]/artifact/bar-baz-[..]/bin\n\ [..]/artifact/bar-baz-[..]/bin/baz_suffix-[..]", &build_script_output, - msg, - "", - None, - ) - .unwrap(); + ); } assert!( @@ -1757,14 +1740,7 @@ fn allow_dep_renames_with_multiple_versions() { .with_stderr_contains("[COMPILING] foo [..]") .run(); let build_script_output = build_script_output_string(&p, "foo"); - match_exact( - "0.5.0\n1.0.0", - &build_script_output, - "build script output", - "", - None, - ) - .unwrap(); + compare::assert_match_exact("0.5.0\n1.0.0", &build_script_output); } #[cargo_test] @@ -3240,26 +3216,18 @@ fn build_only_specified_artifact_library() { .cargo("build -Z bindeps") .masquerade_as_nightly_cargo(&["bindeps"]) .run(); - match_exact( + compare::assert_match_exact( "cdylib present: true\nstaticlib present: false", &build_script_output_string(&cdylib, "foo"), - "build script output", - "", - None, - ) - .unwrap(); + ); let staticlib = create_project("staticlib"); staticlib .cargo("build -Z bindeps") .masquerade_as_nightly_cargo(&["bindeps"]) .run(); - match_exact( + compare::assert_match_exact( "cdylib present: false\nstaticlib present: true", &build_script_output_string(&staticlib, "foo"), - "build script output", - "", - None, - ) - .unwrap(); + ); }