Skip to content

Commit 80059e1

Browse files
Add test for presence of read more links
1 parent 14b508f commit 80059e1

File tree

2 files changed

+34
-2
lines changed

2 files changed

+34
-2
lines changed
+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// Regression test for https://github.com/rust-lang/rust/issues/105677.
2+
// This test ensures that the "Read more" link is only generated when
3+
// there is actually more documentation to read after the short summary.
4+
5+
#![crate_name = "foo"]
6+
7+
pub trait MyFrom {
8+
/// # Hello
9+
/// ## Yolo
10+
/// more!
11+
fn try_from1();
12+
/// a
13+
/// b
14+
/// c
15+
fn try_from2();
16+
/// a
17+
///
18+
/// b
19+
///
20+
/// c
21+
fn try_from3();
22+
}
23+
24+
pub struct NonZero;
25+
26+
// @has 'foo/struct.NonZero.html'
27+
impl MyFrom for NonZero {
28+
// @matches - '//*[@class="docblock"]' '^Hello Read more$'
29+
fn try_from1() {}
30+
// @matches - '//*[@class="docblock"]' '^a\sb\sc$'
31+
fn try_from2() {}
32+
// @matches - '//*[@class="docblock"]' '^a Read more$'
33+
fn try_from3() {}
34+
}

src/test/rustdoc/trait-impl.rs

-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ impl Trait for Struct {
3030
// @has - '//*[@id="method.b"]/../../div[@class="docblock"]' 'These docs contain'
3131
// @has - '//*[@id="method.b"]/../../div[@class="docblock"]/a' 'reference link'
3232
// @has - '//*[@id="method.b"]/../../div[@class="docblock"]/a/@href' 'https://example.com'
33-
// @has - '//*[@id="method.b"]/../../div[@class="docblock"]/a' 'Read more'
34-
// @has - '//*[@id="method.b"]/../../div[@class="docblock"]/a/@href' 'trait.Trait.html#tymethod.b'
3533
fn b() {}
3634

3735
// @!has - '//*[@id="method.c"]/../../div[@class="docblock"]' 'code block'

0 commit comments

Comments
 (0)