Ensure apply_color_by_line doesn't discard newlines

pull/1/head
Wilfred Hughes 2019-01-22 00:35:19 +07:00
parent 1dd56fff47
commit 206e9be4b2
1 changed files with 9 additions and 0 deletions

@ -106,10 +106,19 @@ fn apply_color_by_line(s: &str, ranges: &[LineRange], c: Color) -> String {
res.push_str(line);
}
}
res.push_str("\n");
}
res
}
#[test]
fn apply_color_by_line_no_positions() {
assert_eq!(
apply_color_by_line("foo\nbar\n", &vec![], Color::Black),
"foo\nbar\n"
);
}
#[test]
fn apply_color_no_positions() {
assert_eq!(apply_color("foobar", &vec![], Color::Black), "foobar");