mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-27 07:03:45 +00:00
Add test for trailing newline in diff.
Credits to @afshinm for most of the code.
This commit is contained in:
parent
d0df53d833
commit
d44d4a3fbc
@ -234,4 +234,20 @@ mod test {
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn diff_trailing_newline() {
|
||||
let src = "one\ntwo\nthree\nfour\nfive";
|
||||
let dest = "one\ntwo\nthree\nfour\nfive\n";
|
||||
let diff = make_diff(src, dest, 1);
|
||||
assert_eq!(
|
||||
diff,
|
||||
vec![
|
||||
Mismatch {
|
||||
line_number: 5,
|
||||
lines: vec![Context("five".into()), Expected("".into())],
|
||||
},
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user