Skip to content

Commit 88ac4aa

Browse files
committed
test: switch to assert_match_exact
There is no need to provide additional messages here.
1 parent 950aa4e commit 88ac4aa

File tree

1 file changed

+14
-46
lines changed

1 file changed

+14
-46
lines changed

tests/testsuite/artifact_dep.rs

Lines changed: 14 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Tests specific to artifact dependencies, designated using
22
//! the new `dep = { artifact = "bin", … }` syntax in manifests.
33
4-
use cargo_test_support::compare::match_exact;
4+
use cargo_test_support::compare;
55
use cargo_test_support::registry::{Package, RegistryBuilder};
66
use cargo_test_support::{
77
basic_bin_manifest, basic_manifest, cross_compile, project, publish, registry, rustc_host,
@@ -593,35 +593,27 @@ fn build_script_with_bin_artifacts() {
593593
.run();
594594

595595
let build_script_output = build_script_output_string(&p, "foo");
596-
let msg = "we need the binary directory for this artifact along with all binary paths";
596+
// we need the binary directory for this artifact along with all binary paths
597597
if cfg!(target_env = "msvc") {
598-
match_exact(
598+
compare::assert_match_exact(
599599
"[..]/artifact/bar-[..]/bin/baz.exe\n\
600600
[..]/artifact/bar-[..]/staticlib/bar-[..].lib\n\
601601
[..]/artifact/bar-[..]/cdylib/bar.dll\n\
602602
[..]/artifact/bar-[..]/bin\n\
603603
[..]/artifact/bar-[..]/bin/bar.exe\n\
604604
[..]/artifact/bar-[..]/bin/bar.exe",
605605
&build_script_output,
606-
msg,
607-
"",
608-
None,
609606
)
610-
.unwrap();
611607
} else {
612-
match_exact(
608+
compare::assert_match_exact(
613609
"[..]/artifact/bar-[..]/bin/baz-[..]\n\
614610
[..]/artifact/bar-[..]/staticlib/libbar-[..].a\n\
615611
[..]/artifact/bar-[..]/cdylib/[..]bar.[..]\n\
616612
[..]/artifact/bar-[..]/bin\n\
617613
[..]/artifact/bar-[..]/bin/bar-[..]\n\
618614
[..]/artifact/bar-[..]/bin/bar-[..]",
619615
&build_script_output,
620-
msg,
621-
"",
622-
None,
623616
)
624-
.unwrap();
625617
}
626618

627619
assert!(
@@ -783,31 +775,22 @@ fn build_script_with_selected_dashed_bin_artifact_and_lib_true() {
783775
.run();
784776

785777
let build_script_output = build_script_output_string(&p, "foo");
786-
let msg = "we need the binary directory for this artifact and the binary itself";
787-
778+
// we need the binary directory for this artifact and the binary itself
788779
if cfg!(target_env = "msvc") {
789-
cargo_test_support::compare::match_exact(
780+
compare::assert_match_exact(
790781
&format!(
791782
"[..]/artifact/bar-baz-[..]/bin\n\
792783
[..]/artifact/bar-baz-[..]/bin/baz_suffix{}",
793784
std::env::consts::EXE_SUFFIX,
794785
),
795786
&build_script_output,
796-
msg,
797-
"",
798-
None,
799-
)
800-
.unwrap();
787+
);
801788
} else {
802-
cargo_test_support::compare::match_exact(
789+
compare::assert_match_exact(
803790
"[..]/artifact/bar-baz-[..]/bin\n\
804791
[..]/artifact/bar-baz-[..]/bin/baz_suffix-[..]",
805792
&build_script_output,
806-
msg,
807-
"",
808-
None,
809-
)
810-
.unwrap();
793+
);
811794
}
812795

813796
assert!(
@@ -1757,14 +1740,7 @@ fn allow_dep_renames_with_multiple_versions() {
17571740
.with_stderr_contains("[COMPILING] foo [..]")
17581741
.run();
17591742
let build_script_output = build_script_output_string(&p, "foo");
1760-
match_exact(
1761-
"0.5.0\n1.0.0",
1762-
&build_script_output,
1763-
"build script output",
1764-
"",
1765-
None,
1766-
)
1767-
.unwrap();
1743+
compare::assert_match_exact("0.5.0\n1.0.0", &build_script_output);
17681744
}
17691745

17701746
#[cargo_test]
@@ -3240,26 +3216,18 @@ fn build_only_specified_artifact_library() {
32403216
.cargo("build -Z bindeps")
32413217
.masquerade_as_nightly_cargo(&["bindeps"])
32423218
.run();
3243-
match_exact(
3219+
compare::assert_match_exact(
32443220
"cdylib present: true\nstaticlib present: false",
32453221
&build_script_output_string(&cdylib, "foo"),
3246-
"build script output",
3247-
"",
3248-
None,
3249-
)
3250-
.unwrap();
3222+
);
32513223

32523224
let staticlib = create_project("staticlib");
32533225
staticlib
32543226
.cargo("build -Z bindeps")
32553227
.masquerade_as_nightly_cargo(&["bindeps"])
32563228
.run();
3257-
match_exact(
3229+
compare::assert_match_exact(
32583230
"cdylib present: false\nstaticlib present: true",
32593231
&build_script_output_string(&staticlib, "foo"),
3260-
"build script output",
3261-
"",
3262-
None,
3263-
)
3264-
.unwrap();
3232+
);
32653233
}

0 commit comments

Comments
 (0)