Skip to content

Commit 0f1d4b5

Browse files
Add regression test for #111415
1 parent 88493d2 commit 0f1d4b5

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed
+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Regression test for <https://github.com/rust-lang/rust/issues/111415>.
2+
// This test ensures that only impl blocks are documented in bodies.
3+
4+
#![crate_name = "foo"]
5+
6+
// @has 'foo/index.html'
7+
// Checking there are only three sections.
8+
// @count - '//*[@id="main-content"]/*[@class="small-section-header"]' 3
9+
// @has - '//*[@id="main-content"]/*[@class="small-section-header"]' 'Structs'
10+
// @has - '//*[@id="main-content"]/*[@class="small-section-header"]' 'Functions'
11+
// @has - '//*[@id="main-content"]/*[@class="small-section-header"]' 'Traits'
12+
// Checking that there are only three items.
13+
// @count - '//*[@id="main-content"]//*[@class="item-name"]' 3
14+
// @has - '//*[@id="main-content"]//a[@href="struct.Bar.html"]' 'Bar'
15+
// @has - '//*[@id="main-content"]//a[@href="fn.foo.html"]' 'foo'
16+
// @has - '//*[@id="main-content"]//a[@href="trait.Foo.html"]' 'Foo'
17+
18+
// Now checking that the `foo` method is visible in `Bar` page.
19+
// @has 'foo/struct.Bar.html'
20+
// @has - '//*[@id="method.foo"]/*[@class="code-header"]' 'pub fn foo()'
21+
// @has - '//*[@id="method.bar"]/*[@class="code-header"]' 'fn bar()'
22+
pub struct Bar;
23+
24+
pub trait Foo {
25+
fn bar() {}
26+
}
27+
28+
pub fn foo() {
29+
pub mod inaccessible {}
30+
pub fn inner() {}
31+
pub const BAR: u32 = 0;
32+
impl Bar {
33+
pub fn foo() {}
34+
}
35+
impl Foo for Bar {}
36+
}

0 commit comments

Comments
 (0)