Skip to content

Commit 0abb9d1

Browse files
committed
Add test for multiline note rendering
1 parent be7b658 commit 0abb9d1

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

compiler/rustc_parse/src/parser/tests.rs

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1685,6 +1685,51 @@ error: foo
16851685
);
16861686
}
16871687

1688+
#[test]
1689+
fn multiline_notes() {
1690+
test_harness(
1691+
r#"
1692+
fn foo() {
1693+
a { b { c } d }
1694+
}
1695+
"#,
1696+
vec![
1697+
SpanLabel {
1698+
start: Position { string: "a", count: 1 },
1699+
end: Position { string: "d", count: 1 },
1700+
label: "`a` is a good letter",
1701+
},
1702+
],
1703+
vec![(None, "foo\nbar"), (None, "foo\nbar")],
1704+
r#"
1705+
error: foo
1706+
--> test.rs:3:3
1707+
|
1708+
3 | a { b { c } d }
1709+
| ^^^^^^^^^^^^^ `a` is a good letter
1710+
|
1711+
= note: foo
1712+
bar
1713+
= note: foo
1714+
bar
1715+
1716+
"#,
1717+
r#"
1718+
error: foo
1719+
╭▸ test.rs:3:3
1720+
1721+
3 │ a { b { c } d }
1722+
│ ━━━━━━━━━━━━━ `a` is a good letter
1723+
1724+
├ note: foo
1725+
bar
1726+
╰ note: foo
1727+
bar
1728+
1729+
"#,
1730+
);
1731+
}
1732+
16881733
#[test]
16891734
fn multiple_labels_secondary_without_message() {
16901735
test_harness(

0 commit comments

Comments
 (0)