about summary refs log tree commit diff
path: root/tests/rustdoc/footnote-ids.rs
blob: d3a8435bb4701cf01ed844a09f93f6add6bac563 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// This test ensures that footnotes ID are not duplicated across an item page.
// This is a regression test for <https://github.com/rust-lang/rust/issues/131901>.

#![crate_name = "foo"]

//@ has 'foo/struct.Foo.html'

pub struct Foo;

impl Foo {
    //@ has - '//a[@href="#fn1"]' '1'
    //@ has - '//li[@id="fn1"]' 'Hiya'
    //@ has - '//a[@href="#fn2"]' '2'
    //@ has - '//li[@id="fn2"]' 'Tiya'
    /// Link 1 [^1]
    /// Link 1.1 [^2]
    ///
    /// [^1]: Hiya
    /// [^2]: Tiya
    pub fn l1(){}

    //@ has - '//a[@href="#fn3"]' '1'
    //@ has - '//li[@id="fn3"]' 'Yiya'
    //@ has - '//a[@href="#fn4"]' '2'
    //@ has - '//li[@id="fn4"]' 'Biya'
    /// Link 2 [^1]
    /// Link 3 [^2]
    ///
    /// [^1]: Yiya
    /// [^2]: Biya
    pub fn l2() {}
}

impl Foo {
    //@ has - '//a[@href="#fn5"]' '1'
    //@ has - '//li[@id="fn5"]' 'Ciya'
    /// Link 3 [^1]
    ///
    /// [^1]: Ciya
    pub fn l3(){}
}