summaryrefslogtreecommitdiffstats
path: root/tests/rustdoc/trait-impl.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
commit218caa410aa38c29984be31a5229b9fa717560ee (patch)
treec54bd55eeb6e4c508940a30e94c0032fbd45d677 /tests/rustdoc/trait-impl.rs
parentReleasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz
rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/rustdoc/trait-impl.rs')
-rw-r--r--tests/rustdoc/trait-impl.rs45
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/rustdoc/trait-impl.rs b/tests/rustdoc/trait-impl.rs
new file mode 100644
index 000000000..9cf3226f7
--- /dev/null
+++ b/tests/rustdoc/trait-impl.rs
@@ -0,0 +1,45 @@
+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"]' 'Some long docs'
+ // @!has - '//*[@id="method.a"]/../../div[@class="docblock"]' 'link will be added'
+ // @has - '//*[@id="method.a"]/../../div[@class="docblock"]/a' 'Read more'
+ // @has - '//*[@id="method.a"]/../../div[@class="docblock"]/a/@href' 'trait.Trait.html#tymethod.a'
+ fn a() {}
+
+ // @has - '//*[@id="method.b"]/../../div[@class="docblock"]' 'These docs contain'
+ // @has - '//*[@id="method.b"]/../../div[@class="docblock"]/a' 'reference link'
+ // @has - '//*[@id="method.b"]/../../div[@class="docblock"]/a/@href' 'https://example.com'
+ fn b() {}
+
+ // @!has - '//*[@id="method.c"]/../../div[@class="docblock"]' '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"]' 'Escaped formatting a*b*c* works'
+ // @!has - '//*[@id="method.d"]/../../div[@class="docblock"]/em' ''
+ fn d() {}
+
+ // @has - '//*[@id="impl-Trait-for-Struct"]/h3//a/@href' 'trait.Trait.html'
+}