Skip to content

Commit 4b0ab36

Browse files
committed
Add test for multiline note rendering
1 parent d3825f2 commit 4b0ab36

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

compiler/rustc_parse/src/parser/tests.rs

+45
Original file line numberDiff line numberDiff line change
@@ -1668,6 +1668,51 @@ error: foo
16681668
);
16691669
}
16701670

1671+
#[test]
1672+
fn multiline_notes() {
1673+
test_harness(
1674+
r#"
1675+
fn foo() {
1676+
a { b { c } d }
1677+
}
1678+
"#,
1679+
vec![
1680+
SpanLabel {
1681+
start: Position { string: "a", count: 1 },
1682+
end: Position { string: "d", count: 1 },
1683+
label: "`a` is a good letter",
1684+
},
1685+
],
1686+
vec![(None, "foo\nbar"), (None, "foo\nbar")],
1687+
r#"
1688+
error: foo
1689+
--> test.rs:3:3
1690+
|
1691+
3 | a { b { c } d }
1692+
| ^^^^^^^^^^^^^ `a` is a good letter
1693+
|
1694+
= note: foo
1695+
bar
1696+
= note: foo
1697+
bar
1698+
1699+
"#,
1700+
r#"
1701+
error: foo
1702+
╭▸ test.rs:3:3
1703+
1704+
3 │ a { b { c } d }
1705+
│ ━━━━━━━━━━━━━ `a` is a good letter
1706+
1707+
├ note: foo
1708+
bar
1709+
╰ note: foo
1710+
bar
1711+
1712+
"#,
1713+
);
1714+
}
1715+
16711716
#[test]
16721717
fn multiple_labels_secondary_without_message() {
16731718
test_harness(

0 commit comments

Comments
 (0)