Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/renderer/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,11 @@ pub(crate) fn render(renderer: &Renderer, groups: Report<'_>) -> String {
max_line_num_len + 1,
);
}
if peek.is_none() && g == 0 && group_len > 1 {
if peek.is_none()
&& title_style == TitleStyle::MainHeader
&& g == 0
&& group_len > 1
{
draw_col_separator_end(
renderer,
&mut buffer,
Expand Down
50 changes: 50 additions & 0 deletions tests/formatter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,56 @@ error:
assert_data_eq!(renderer.render(input), expected_unicode);
}

#[test]
fn test_multi_group_no_snippet() {
let input = &[
Group::with_title(Level::ERROR.primary_title("the core problem")),
Group::with_title(Level::NOTE.secondary_title("more information")),
Group::with_title(Level::HELP.secondary_title("a way to fix this")),
];
let expected_ascii = str![[r#"
error: the core problem
|
note: more information
help: a way to fix this
"#]];
let renderer = Renderer::plain();
assert_data_eq!(renderer.render(input), expected_ascii);

let expected_unicode = str![[r#"
error: the core problem
╰╴
note: more information
help: a way to fix this
"#]];
let renderer = renderer.decor_style(DecorStyle::Unicode);
assert_data_eq!(renderer.render(input), expected_unicode);
}

#[test]
fn test_multi_secondary_group_no_snippet() {
let input = &[
Group::with_title(Level::ERROR.secondary_title("the core problem")),
Group::with_title(Level::NOTE.secondary_title("more information")),
Group::with_title(Level::HELP.secondary_title("a way to fix this")),
];
let expected_ascii = str![[r#"
error: the core problem
note: more information
help: a way to fix this
"#]];
let renderer = Renderer::plain();
assert_data_eq!(renderer.render(input), expected_ascii);

let expected_unicode = str![[r#"
error: the core problem
note: more information
help: a way to fix this
"#]];
let renderer = renderer.decor_style(DecorStyle::Unicode);
assert_data_eq!(renderer.render(input), expected_unicode);
}

#[test]
#[should_panic]
fn test_i26() {
Expand Down
Loading