Skip to content

Commit dfb8d9a

Browse files
Update jump to def macro link generation test
1 parent 635940b commit dfb8d9a

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-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: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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+
// We also check the "title" attributes.
14+
//@ has - '//a[@href="{{channel}}/core/fmt/macros/derive.Debug.html"]/@title' 'derive core::fmt::macros::Debug'
15+
//@ has - '//a[@href="{{channel}}/core/cmp/derive.PartialEq.html"]/@title' 'derive core::cmp::PartialEq'
16+
17+
// Then we check that they are the same in jump to def.
18+
19+
/// [Debug][derive@Debug] and [PartialEq][derive@PartialEq]
20+
//@ has 'src/foo/derive-macro.rs.html'
21+
//@ has - '//a[@href="{{channel}}/core/fmt/macros/derive.Debug.html"]' 'Debug'
22+
//@ has - '//a[@href="{{channel}}/core/cmp/derive.PartialEq.html"]' 'PartialEq'
23+
#[derive(Debug, PartialEq)]
24+
pub struct Bar;

0 commit comments

Comments
 (0)