mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-25 11:14:46 +00:00
Remove normalized_lines_match, it is not needed.
This commit is contained in:
parent
6dff99781d
commit
24b8936c20
@ -512,13 +512,6 @@ pub fn lines_match(expected: &str, mut actual: &str) -> bool {
|
||||
actual.is_empty() || expected.ends_with("[..]")
|
||||
}
|
||||
|
||||
/// Variant of `lines_match` that applies normalization to the strings.
|
||||
pub fn normalized_lines_match(expected: &str, actual: &str, cwd: Option<&Path>) -> bool {
|
||||
let expected = normalize_expected(expected, cwd);
|
||||
let actual = normalize_actual(actual, cwd);
|
||||
lines_match(&expected, &actual)
|
||||
}
|
||||
|
||||
/// Compares JSON object for approximate equality.
|
||||
/// You can use `[..]` wildcard in strings (useful for OS-dependent things such
|
||||
/// as paths). You can use a `"{...}"` string literal as a wildcard for
|
||||
|
@ -5,8 +5,8 @@ use cargo::util::config::{self, Config, SslVersionConfig, StringList};
|
||||
use cargo::util::interning::InternedString;
|
||||
use cargo::util::toml::{self, VecStringOrBool as VSOB};
|
||||
use cargo::CargoResult;
|
||||
use cargo_test_support::compare::normalized_lines_match;
|
||||
use cargo_test_support::{paths, project, t};
|
||||
use cargo_test_support::compare;
|
||||
use cargo_test_support::{panic_error, paths, project, t};
|
||||
use serde::Deserialize;
|
||||
use std::borrow::Borrow;
|
||||
use std::collections::{BTreeMap, HashMap};
|
||||
@ -210,11 +210,8 @@ pub fn assert_error<E: Borrow<anyhow::Error>>(error: E, msgs: &str) {
|
||||
|
||||
#[track_caller]
|
||||
pub fn assert_match(expected: &str, actual: &str) {
|
||||
if !normalized_lines_match(expected, actual, None) {
|
||||
panic!(
|
||||
"Did not find expected:\n{}\nActual:\n{}\n",
|
||||
expected, actual
|
||||
);
|
||||
if let Err(e) = compare::match_exact(expected, actual, "output", "", None) {
|
||||
panic_error("", e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -277,15 +274,7 @@ f1 = 1
|
||||
|
||||
// It should NOT have warned for the symlink.
|
||||
let output = read_output(config);
|
||||
let unexpected = "\
|
||||
warning: Both `[..]/.cargo/config` and `[..]/.cargo/config.toml` exist. Using `[..]/.cargo/config`
|
||||
";
|
||||
if normalized_lines_match(unexpected, &output, None) {
|
||||
panic!(
|
||||
"Found unexpected:\n{}\nActual error:\n{}\n",
|
||||
unexpected, output
|
||||
);
|
||||
}
|
||||
assert_eq!(output, "");
|
||||
}
|
||||
|
||||
#[cargo_test]
|
||||
|
Loading…
x
Reference in New Issue
Block a user