From 5fda9b0e5ba06a7b95f4a5e936f114df1ad2e7ea Mon Sep 17 00:00:00 2001 From: Lucas Holten Date: Thu, 11 Jan 2024 13:08:55 +0100 Subject: [PATCH] Update test so that it finds the bug. The previous test would still have overlap between the first and last context because of contexts are extended with `context_lines`. --- tests/graphical.rs | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/tests/graphical.rs b/tests/graphical.rs index 14178bf9..5114d43a 100644 --- a/tests/graphical.rs +++ b/tests/graphical.rs @@ -1730,12 +1730,12 @@ fn triple_adjacent_highlight() -> Result<(), MietteError> { highlight3: SourceSpan, } - let src = "source\n text\n here".to_string(); + let src = "source\n\n\n text\n\n\n here".to_string(); let err = MyBad { src: NamedSource::new("bad_file.rs", src), highlight1: (0, 6).into(), - highlight2: (9, 4).into(), - highlight3: (18, 4).into(), + highlight2: (11, 4).into(), + highlight3: (22, 4).into(), }; let out = fmt_report(err.into()); println!("Error: {}", out); @@ -1746,17 +1746,19 @@ fn triple_adjacent_highlight() -> Result<(), MietteError> { 1 │ source · ───┬── · ╰── this bit here - 2 │ text + 2 │ + 3 │ + 4 │ text · ──┬─ · ╰── also this bit - 3 │ here + 5 │ + 6 │ + 7 │ here · ──┬─ · ╰── finally we got ╰──── help: try doing it better next time? -" - .trim_start() - .to_string(); - assert_eq!(expected, out); +"; + assert_eq!(expected, &out); Ok(()) }