Skip to content

Commit 87a7bdf

Browse files
Update jump to def macro link generation test
1 parent 10fca81 commit 87a7bdf

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

tests/rustdoc/jump-to-def-assoc-items.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ impl C {
2626
pub fn wat() {}
2727
}
2828

29-
//@ has - '//a[@href="{{channel}}/core/fmt/macros/macro.Debug.html"]' 'Debug'
30-
//@ has - '//a[@href="{{channel}}/core/cmp/macro.PartialEq.html"]' 'PartialEq'
29+
// These two links must not change and in particular must contain `/derive.`!
30+
//@ has - '//a[@href="{{channel}}/core/fmt/macros/derive.Debug.html"]' 'Debug'
31+
//@ has - '//a[@href="{{channel}}/core/cmp/derive.PartialEq.html"]' 'PartialEq'
3132
#[derive(Debug, PartialEq)]
3233
pub struct Bar;
3334
impl Trait for Bar {
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// This test ensures that the same link is generated in both intra-doc links
2+
// and in jump to def links.
3+
4+
//@ compile-flags: -Zunstable-options --generate-link-to-definition
5+
6+
#![crate_name = "foo"]
7+
8+
// First we check intra-doc links.
9+
//@ has 'foo/struct.Bar.html'
10+
//@ has - '//a[@href="{{channel}}/core/fmt/macros/derive.Debug.html"]' 'Debug'
11+
//@ has - '//a[@href="{{channel}}/core/cmp/derive.PartialEq.html"]' 'PartialEq'
12+
13+
14+
// Then we check that they are the same in jump to def.
15+
16+
/// [Debug][derive@Debug] and [PartialEq][derive@PartialEq]
17+
//@ has 'src/foo/jump-to-def-intra-doc.rs.html'
18+
//@ has - '//a[@href="{{channel}}/core/fmt/macros/derive.Debug.html"]' 'Debug'
19+
//@ has - '//a[@href="{{channel}}/core/cmp/derive.PartialEq.html"]' 'PartialEq'
20+
#[derive(Debug, PartialEq)]
21+
pub struct Bar;

0 commit comments

Comments
 (0)