Remove fragile test

This test needs to be updated after every change (it contains line
number), which is annoying.

It also fails on windows due to \, so it's easier to remove it.
This commit is contained in:
Aleksey Kladov 2020-06-27 20:45:59 +02:00
parent 18e4e9fb0b
commit 175e48e5be

View File

@ -78,7 +78,8 @@ fn locate(&self, file: &str) -> Location {
line_start += line.len();
}
let (literal_start, line_indent) = target_line.unwrap();
let literal_length = file[literal_start..].find("]]").expect("Couldn't find matching `]]` for `expect![[`.");
let literal_length =
file[literal_start..].find("]]").expect("Couldn't find matching `]]` for `expect![[`.");
let literal_range = literal_start..literal_start + literal_length;
Location { line_indent, literal_range }
}
@ -238,34 +239,6 @@ fn workspace_root() -> PathBuf {
mod tests {
use super::*;
#[test]
fn test_expect_macro() {
let empty = expect![[]];
expect![[r#"
Expect {
file: "crates/expect/src/lib.rs",
line: 241,
column: 21,
data: "",
}
"#]]
.assert_debug_eq(&empty);
let expect = expect![["
hello
world
"]];
expect![[r#"
Expect {
file: "crates/expect/src/lib.rs",
line: 252,
column: 22,
data: "\n hello\n world\n ",
}
"#]]
.assert_debug_eq(&expect);
}
#[test]
fn test_format_patch() {
let patch = format_patch(0, "hello\nworld\n");