Skip to content

Commit 18b4812

Browse files
committed
refactor: Port from matches_unordered to assert_e2e
1 parent 77810c4 commit 18b4812

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

crates/cargo-test-support/src/compare.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ pub(crate) fn assert_match_exact(expected: &str, actual: &str) {
351351
/// of the lines.
352352
///
353353
/// See [Patterns](index.html#patterns) for more information on pattern matching.
354-
pub fn match_unordered(expected: &str, actual: &str, cwd: Option<&Path>) -> Result<()> {
354+
pub(crate) fn match_unordered(expected: &str, actual: &str, cwd: Option<&Path>) -> Result<()> {
355355
let expected = normalize_expected(expected, cwd);
356356
let actual = normalize_actual(actual, cwd);
357357
let e: Vec<_> = expected.lines().map(|line| WildStr::new(line)).collect();

tests/testsuite/build.rs

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,13 @@ use cargo::{
66
ops::CompileOptions,
77
GlobalContext,
88
};
9+
use cargo_test_support::compare::assert_e2e;
910
use cargo_test_support::paths::{root, CargoPathExt};
11+
use cargo_test_support::prelude::*;
1012
use cargo_test_support::registry::Package;
13+
use cargo_test_support::str;
1114
use cargo_test_support::{
12-
basic_bin_manifest, basic_lib_manifest, basic_manifest, cargo_exe, cargo_process, compare, git,
15+
basic_bin_manifest, basic_lib_manifest, basic_manifest, cargo_exe, cargo_process, git,
1316
is_nightly, main_file, paths, process, project, rustc_host, sleep_ms, symlink_supported, t,
1417
tools, Execs, ProjectBuilder,
1518
};
@@ -6448,17 +6451,17 @@ fn close_output() {
64486451
};
64496452

64506453
let stderr = spawn(false);
6451-
compare::match_unordered(
6452-
"\
6453-
[COMPILING] foo [..]
6454+
assert_e2e().eq(
6455+
&stderr,
6456+
str![[r#"
6457+
[COMPILING] foo v0.1.0 ([ROOT]/foo)
64546458
hello stderr!
6455-
[ERROR] [..]
6459+
[ERROR] Broken pipe (os error 32)
64566460
[WARNING] build failed, waiting for other jobs to finish...
6457-
",
6458-
&stderr,
6459-
None,
6460-
)
6461-
.unwrap();
6461+
6462+
"#]]
6463+
.unordered(),
6464+
);
64626465

64636466
// Try again with stderr.
64646467
p.build_dir().rm_rf();

0 commit comments

Comments
 (0)