]> git.proxmox.com Git - rustc.git/blame - src/test/rustdoc/trait-impl.rs
New upstream version 1.54.0+dfsg1
[rustc.git] / src / test / rustdoc / trait-impl.rs
CommitLineData
1b1a35ee
XL
1pub 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
21pub struct Struct;
22
23impl Trait for Struct {
17df50a5
XL
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'
1b1a35ee
XL
28 fn a() {}
29
17df50a5
XL
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'
1b1a35ee
XL
35 fn b() {}
36
17df50a5
XL
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'
1b1a35ee
XL
40 fn c() {}
41
17df50a5
XL
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'
1b1a35ee 44 fn d() {}
17df50a5
XL
45
46 // @has - '//*[@id="impl-Trait"]/h3//a/@href' 'trait.Trait.html'
1b1a35ee 47}