Skip to content

Commit ed535a3

Browse files
committed
test: Primary title used second group
1 parent b9dc9e5 commit ed535a3

File tree

3 files changed

+67
-0
lines changed

3 files changed

+67
-0
lines changed

tests/color/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ mod fold_trailing;
1212
mod issue_9;
1313
mod multiline_removal_suggestion;
1414
mod multiple_annotations;
15+
mod primary_title_second_group;
1516
mod simple;
1617
mod strip_line;
1718
mod strip_line_char;
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
use annotate_snippets::{AnnotationKind, Group, Level, Renderer, Snippet};
2+
3+
use snapbox::{assert_data_eq, file};
4+
5+
#[test]
6+
fn case() {
7+
let report =
8+
&[
9+
Group::with_title(Level::ERROR.primary_title("mismatched types").id("E0308")).element(
10+
Snippet::source(" slices: vec![\"A\",")
11+
.line_start(13)
12+
.path("src/multislice.rs")
13+
.annotation(AnnotationKind::Primary.span(21..24).label(
14+
"expected struct `annotate_snippets::snippet::Slice`, found reference",
15+
)),
16+
),
17+
Group::with_title(Level::NOTE.primary_title(
18+
"expected type: `snippet::Annotation`\n found type: `__&__snippet::Annotation`",
19+
)),
20+
];
21+
22+
let expected = file!["primary_title_second_group.term.svg"];
23+
let renderer = Renderer::styled();
24+
assert_data_eq!(renderer.render(report), expected);
25+
}
Lines changed: 41 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)