Skip to content

Commit 99cae9c

Browse files
committed
rustdoc-json: Add tests for visibility of impls
1 parent 3603a84 commit 99cae9c

File tree

3 files changed

+81
-0
lines changed

3 files changed

+81
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#![feature(no_core)]
2+
#![no_core]
3+
4+
pub struct Foo;
5+
6+
/// impl Foo priv
7+
impl Foo {
8+
fn baz() {}
9+
}
10+
// @!has '$.index[*][?(@.docs=="impl Foo priv")]'
11+
12+
13+
/// impl Foo pub
14+
impl Foo {
15+
pub fn qux() {}
16+
}
17+
// @is '$.index[*][?(@.docs=="impl Foo pub")].visibility' '"default"'
18+
19+
20+
/// impl Foo hidden
21+
impl Foo {
22+
#[doc(hidden)]
23+
pub fn __quazl(){}
24+
}
25+
// FIXME(#111564): Is this the right behaviour?
26+
// @is '$.index[*][?(@.docs=="impl Foo hidden")].visibility' '"default"'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// compile-flags: --document-hidden-items
2+
#![feature(no_core)]
3+
#![no_core]
4+
5+
pub struct Foo;
6+
7+
/// impl Foo priv
8+
impl Foo {
9+
fn baz() {}
10+
}
11+
// FIXME(#111564): Is this the right behaviour?
12+
// @is '$.index[*][?(@.docs=="impl Foo priv")].visibility' '"default"'
13+
14+
15+
/// impl Foo pub
16+
impl Foo {
17+
pub fn qux() {}
18+
}
19+
// @is '$.index[*][?(@.docs=="impl Foo pub")].visibility' '"default"'
20+
21+
22+
/// impl Foo hidden
23+
impl Foo {
24+
#[doc(hidden)]
25+
pub fn __quazl(){}
26+
}
27+
// FIXME(#111564): Is this the right behaviour?
28+
// @is '$.index[*][?(@.docs=="impl Foo hidden")].visibility' '"default"'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// compile-flags: --document-private-items
2+
#![feature(no_core)]
3+
#![no_core]
4+
5+
pub struct Foo;
6+
7+
/// impl Foo priv
8+
impl Foo {
9+
fn baz() {}
10+
}
11+
// @is '$.index[*][?(@.docs=="impl Foo priv")].visibility' '"default"'
12+
13+
14+
/// impl Foo pub
15+
impl Foo {
16+
pub fn qux() {}
17+
}
18+
// @is '$.index[*][?(@.docs=="impl Foo pub")].visibility' '"default"'
19+
20+
21+
/// impl Foo hidden
22+
impl Foo {
23+
#[doc(hidden)]
24+
pub fn __quazl(){}
25+
}
26+
// FIXME(#111564): Is this the right behaviour?
27+
// @is '$.index[*][?(@.docs=="impl Foo hidden")].visibility' '"default"'

0 commit comments

Comments
 (0)