diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:02:58 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:02:58 +0000 |
commit | 698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch) | |
tree | 173a775858bd501c378080a10dca74132f05bc50 /src/test/rustdoc/trait-impl.rs | |
parent | Initial commit. (diff) | |
download | rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip |
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | src/test/rustdoc/trait-impl.rs | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/test/rustdoc/trait-impl.rs b/src/test/rustdoc/trait-impl.rs new file mode 100644 index 000000000..4f7e2dfe3 --- /dev/null +++ b/src/test/rustdoc/trait-impl.rs @@ -0,0 +1,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' +} |