summaryrefslogtreecommitdiffstats
path: root/src/test/rustdoc/trait-impl.rs
blob: 4f7e2dfe3b9a53310e1d63b20394649461869462 (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
42
43
44
45
46
47
pub trait Trait {
    /// Some long docs here.
    ///
    /// These docs are long enough that a link will be added to the end.
    fn a();

    /// These docs contain a [reference link].
    ///
    /// [reference link]: https://example.com
    fn b();

    /// ```
    /// This code block should not be in the output, but a Read more link should be generated
    /// ```
    fn c();

    /// Escaped formatting a\*b\*c\* works
    fn d();
}

pub struct Struct;

impl Trait for Struct {
    // @has trait_impl/struct.Struct.html '//*[@id="method.a"]/../../div[@class="docblock"]/p' 'Some long docs'
    // @!has - '//*[@id="method.a"]/../../div[@class="docblock"]/p' 'link will be added'
    // @has - '//*[@id="method.a"]/../../div[@class="docblock"]/p/a' 'Read more'
    // @has - '//*[@id="method.a"]/../../div[@class="docblock"]/p/a/@href' 'trait.Trait.html#tymethod.a'
    fn a() {}

    // @has - '//*[@id="method.b"]/../../div[@class="docblock"]/p' 'These docs contain'
    // @has - '//*[@id="method.b"]/../../div[@class="docblock"]/p/a' 'reference link'
    // @has - '//*[@id="method.b"]/../../div[@class="docblock"]/p/a/@href' 'https://example.com'
    // @has - '//*[@id="method.b"]/../../div[@class="docblock"]/p/a' 'Read more'
    // @has - '//*[@id="method.b"]/../../div[@class="docblock"]/p/a/@href' 'trait.Trait.html#tymethod.b'
    fn b() {}

    // @!has - '//*[@id="method.c"]/../../div[@class="docblock"]/p' 'code block'
    // @has - '//*[@id="method.c"]/../../div[@class="docblock"]/a' 'Read more'
    // @has - '//*[@id="method.c"]/../../div[@class="docblock"]/a/@href' 'trait.Trait.html#tymethod.c'
    fn c() {}

    // @has - '//*[@id="method.d"]/../../div[@class="docblock"]/p' 'Escaped formatting a*b*c* works'
    // @!has - '//*[@id="method.d"]/../../div[@class="docblock"]/p/em'
    fn d() {}

    // @has - '//*[@id="impl-Trait-for-Struct"]/h3//a/@href' 'trait.Trait.html'
}