Skip to content

Commit 1c0ac2b

Browse files
committed
Cleanup hover links tests
1 parent 84acd56 commit 1c0ac2b

File tree

1 file changed

+74
-88
lines changed

1 file changed

+74
-88
lines changed

crates/ide/src/hover.rs

Lines changed: 74 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1407,12 +1407,11 @@ fn foo() { let bar = Ba<|>r; }
14071407
#[test]
14081408
fn test_hover_path_link() {
14091409
check(
1410-
r"
1411-
//- /lib.rs
1412-
pub struct Foo;
1413-
/// [Foo](struct.Foo.html)
1414-
pub struct B<|>ar
1415-
",
1410+
r#"
1411+
pub struct Foo;
1412+
/// [Foo](struct.Foo.html)
1413+
pub struct B<|>ar
1414+
"#,
14161415
expect![[r#"
14171416
*Bar*
14181417
@@ -1434,12 +1433,11 @@ fn foo() { let bar = Ba<|>r; }
14341433
#[test]
14351434
fn test_hover_path_link_no_strip() {
14361435
check(
1437-
r"
1438-
//- /lib.rs
1439-
pub struct Foo;
1440-
/// [struct Foo](struct.Foo.html)
1441-
pub struct B<|>ar
1442-
",
1436+
r#"
1437+
pub struct Foo;
1438+
/// [struct Foo](struct.Foo.html)
1439+
pub struct B<|>ar
1440+
"#,
14431441
expect![[r#"
14441442
*Bar*
14451443
@@ -1462,14 +1460,13 @@ fn foo() { let bar = Ba<|>r; }
14621460
#[test]
14631461
fn test_hover_path_link_field() {
14641462
check(
1465-
r"
1466-
//- /lib.rs
1467-
pub struct Foo;
1468-
pub struct Bar {
1469-
/// [Foo](struct.Foo.html)
1470-
fie<|>ld: ()
1471-
}
1472-
",
1463+
r#"
1464+
pub struct Foo;
1465+
pub struct Bar {
1466+
/// [Foo](struct.Foo.html)
1467+
fie<|>ld: ()
1468+
}
1469+
"#,
14731470
expect![[r#"
14741471
*field*
14751472
@@ -1491,14 +1488,13 @@ fn foo() { let bar = Ba<|>r; }
14911488
#[test]
14921489
fn test_hover_intra_link() {
14931490
check(
1494-
r"
1495-
//- /lib.rs
1496-
pub mod foo {
1497-
pub struct Foo;
1498-
}
1499-
/// [Foo](foo::Foo)
1500-
pub struct B<|>ar
1501-
",
1491+
r#"
1492+
pub mod foo {
1493+
pub struct Foo;
1494+
}
1495+
/// [Foo](foo::Foo)
1496+
pub struct B<|>ar
1497+
"#,
15021498
expect![[r#"
15031499
*Bar*
15041500
@@ -1521,16 +1517,14 @@ fn foo() { let bar = Ba<|>r; }
15211517
fn test_hover_intra_link_html_root_url() {
15221518
check(
15231519
r#"
1524-
//- /lib.rs
1525-
1526-
#![doc(arbitrary_attribute = "test", html_root_url = "https:/example.com", arbitrary_attribute2)]
1520+
#![doc(arbitrary_attribute = "test", html_root_url = "https:/example.com", arbitrary_attribute2)]
15271521
1528-
pub mod foo {
1529-
pub struct Foo;
1530-
}
1531-
/// [Foo](foo::Foo)
1532-
pub struct B<|>ar
1533-
"#,
1522+
pub mod foo {
1523+
pub struct Foo;
1524+
}
1525+
/// [Foo](foo::Foo)
1526+
pub struct B<|>ar
1527+
"#,
15341528
expect![[r#"
15351529
*Bar*
15361530
@@ -1552,12 +1546,11 @@ fn foo() { let bar = Ba<|>r; }
15521546
#[test]
15531547
fn test_hover_intra_link_shortlink() {
15541548
check(
1555-
r"
1556-
//- /lib.rs
1557-
pub struct Foo;
1558-
/// [Foo]
1559-
pub struct B<|>ar
1560-
",
1549+
r#"
1550+
pub struct Foo;
1551+
/// [Foo]
1552+
pub struct B<|>ar
1553+
"#,
15611554
expect![[r#"
15621555
*Bar*
15631556
@@ -1579,12 +1572,11 @@ fn foo() { let bar = Ba<|>r; }
15791572
#[test]
15801573
fn test_hover_intra_link_shortlink_code() {
15811574
check(
1582-
r"
1583-
//- /lib.rs
1584-
pub struct Foo;
1585-
/// [`Foo`]
1586-
pub struct B<|>ar
1587-
",
1575+
r#"
1576+
pub struct Foo;
1577+
/// [`Foo`]
1578+
pub struct B<|>ar
1579+
"#,
15881580
expect![[r#"
15891581
*Bar*
15901582
@@ -1606,13 +1598,12 @@ fn foo() { let bar = Ba<|>r; }
16061598
#[test]
16071599
fn test_hover_intra_link_namespaced() {
16081600
check(
1609-
r"
1610-
//- /lib.rs
1611-
pub struct Foo;
1612-
fn Foo() {}
1613-
/// [Foo()]
1614-
pub struct B<|>ar
1615-
",
1601+
r#"
1602+
pub struct Foo;
1603+
fn Foo() {}
1604+
/// [Foo()]
1605+
pub struct B<|>ar
1606+
"#,
16161607
expect![[r#"
16171608
*Bar*
16181609
@@ -1634,12 +1625,11 @@ fn foo() { let bar = Ba<|>r; }
16341625
#[test]
16351626
fn test_hover_intra_link_shortlink_namspaced_code() {
16361627
check(
1637-
r"
1638-
//- /lib.rs
1639-
pub struct Foo;
1640-
/// [`struct Foo`]
1641-
pub struct B<|>ar
1642-
",
1628+
r#"
1629+
pub struct Foo;
1630+
/// [`struct Foo`]
1631+
pub struct B<|>ar
1632+
"#,
16431633
expect![[r#"
16441634
*Bar*
16451635
@@ -1661,12 +1651,11 @@ fn foo() { let bar = Ba<|>r; }
16611651
#[test]
16621652
fn test_hover_intra_link_shortlink_namspaced_code_with_at() {
16631653
check(
1664-
r"
1665-
//- /lib.rs
1666-
pub struct Foo;
1667-
/// [`struct@Foo`]
1668-
pub struct B<|>ar
1669-
",
1654+
r#"
1655+
pub struct Foo;
1656+
/// [`struct@Foo`]
1657+
pub struct B<|>ar
1658+
"#,
16701659
expect![[r#"
16711660
*Bar*
16721661
@@ -1688,14 +1677,13 @@ fn foo() { let bar = Ba<|>r; }
16881677
#[test]
16891678
fn test_hover_intra_link_reference() {
16901679
check(
1691-
r"
1692-
//- /lib.rs
1693-
pub struct Foo;
1694-
/// [my Foo][foo]
1695-
///
1696-
/// [foo]: Foo
1697-
pub struct B<|>ar
1698-
",
1680+
r#"
1681+
pub struct Foo;
1682+
/// [my Foo][foo]
1683+
///
1684+
/// [foo]: Foo
1685+
pub struct B<|>ar
1686+
"#,
16991687
expect![[r#"
17001688
*Bar*
17011689
@@ -1717,12 +1705,11 @@ fn foo() { let bar = Ba<|>r; }
17171705
#[test]
17181706
fn test_hover_external_url() {
17191707
check(
1720-
r"
1721-
//- /lib.rs
1722-
pub struct Foo;
1723-
/// [external](https://www.google.com)
1724-
pub struct B<|>ar
1725-
",
1708+
r#"
1709+
pub struct Foo;
1710+
/// [external](https://www.google.com)
1711+
pub struct B<|>ar
1712+
"#,
17261713
expect![[r#"
17271714
*Bar*
17281715
@@ -1745,12 +1732,11 @@ fn foo() { let bar = Ba<|>r; }
17451732
#[test]
17461733
fn test_hover_unknown_target() {
17471734
check(
1748-
r"
1749-
//- /lib.rs
1750-
pub struct Foo;
1751-
/// [baz](Baz)
1752-
pub struct B<|>ar
1753-
",
1735+
r#"
1736+
pub struct Foo;
1737+
/// [baz](Baz)
1738+
pub struct B<|>ar
1739+
"#,
17541740
expect![[r#"
17551741
*Bar*
17561742

0 commit comments

Comments
 (0)