]> git.lizzy.rs Git - rust.git/blob - src/test/rustdoc/trait-impl.rs
Merge from rustc
[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"]' 'Some long docs'
25     // @!has - '//*[@id="method.a"]/../../div[@class="docblock"]' 'link will be added'
26     // @has - '//*[@id="method.a"]/../../div[@class="docblock"]/a' 'Read more'
27     // @has - '//*[@id="method.a"]/../../div[@class="docblock"]/a/@href' 'trait.Trait.html#tymethod.a'
28     fn a() {}
29
30     // @has - '//*[@id="method.b"]/../../div[@class="docblock"]' 'These docs contain'
31     // @has - '//*[@id="method.b"]/../../div[@class="docblock"]/a' 'reference link'
32     // @has - '//*[@id="method.b"]/../../div[@class="docblock"]/a/@href' 'https://example.com'
33     fn b() {}
34
35     // @!has - '//*[@id="method.c"]/../../div[@class="docblock"]' 'code block'
36     // @has - '//*[@id="method.c"]/../../div[@class="docblock"]/a' 'Read more'
37     // @has - '//*[@id="method.c"]/../../div[@class="docblock"]/a/@href' 'trait.Trait.html#tymethod.c'
38     fn c() {}
39
40     // @has - '//*[@id="method.d"]/../../div[@class="docblock"]' 'Escaped formatting a*b*c* works'
41     // @!has - '//*[@id="method.d"]/../../div[@class="docblock"]/em' ''
42     fn d() {}
43
44     // @has - '//*[@id="impl-Trait-for-Struct"]/h3//a/@href' 'trait.Trait.html'
45 }