]> git.lizzy.rs Git - rust.git/blob - src/test/rustdoc/trait-impl.rs
Rollup merge of #100359 - b-naber:valtrees-pretty-print-ice, r=lcnr
[rust.git] / src / test / rustdoc / trait-impl.rs
1 pub trait Trait {
2     /// Some long docs here.
3     ///
4     /// These docs are long enough that a link will be added to the end.
5     fn a();
6
7     /// These docs contain a [reference link].
8     ///
9     /// [reference link]: https://example.com
10     fn b();
11
12     /// ```
13     /// This code block should not be in the output, but a Read more link should be generated
14     /// ```
15     fn c();
16
17     /// Escaped formatting a\*b\*c\* works
18     fn d();
19 }
20
21 pub struct Struct;
22
23 impl Trait for Struct {
24     // @has trait_impl/struct.Struct.html '//*[@id="method.a"]/../../div[@class="docblock"]/p' 'Some long docs'
25     // @!has - '//*[@id="method.a"]/../../div[@class="docblock"]/p' 'link will be added'
26     // @has - '//*[@id="method.a"]/../../div[@class="docblock"]/p/a' 'Read more'
27     // @has - '//*[@id="method.a"]/../../div[@class="docblock"]/p/a/@href' 'trait.Trait.html#tymethod.a'
28     fn a() {}
29
30     // @has - '//*[@id="method.b"]/../../div[@class="docblock"]/p' 'These docs contain'
31     // @has - '//*[@id="method.b"]/../../div[@class="docblock"]/p/a' 'reference link'
32     // @has - '//*[@id="method.b"]/../../div[@class="docblock"]/p/a/@href' 'https://example.com'
33     // @has - '//*[@id="method.b"]/../../div[@class="docblock"]/p/a' 'Read more'
34     // @has - '//*[@id="method.b"]/../../div[@class="docblock"]/p/a/@href' 'trait.Trait.html#tymethod.b'
35     fn b() {}
36
37     // @!has - '//*[@id="method.c"]/../../div[@class="docblock"]/p' 'code block'
38     // @has - '//*[@id="method.c"]/../../div[@class="docblock"]/a' 'Read more'
39     // @has - '//*[@id="method.c"]/../../div[@class="docblock"]/a/@href' 'trait.Trait.html#tymethod.c'
40     fn c() {}
41
42     // @has - '//*[@id="method.d"]/../../div[@class="docblock"]/p' 'Escaped formatting a*b*c* works'
43     // @!has - '//*[@id="method.d"]/../../div[@class="docblock"]/p/em'
44     fn d() {}
45
46     // @has - '//*[@id="impl-Trait-for-Struct"]/h3//a/@href' 'trait.Trait.html'
47 }