-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rustdoc-json: Add tests for visibility of impls
- Loading branch information
1 parent
3603a84
commit 99cae9c
Showing
3 changed files
with
81 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#![feature(no_core)] | ||
#![no_core] | ||
|
||
pub struct Foo; | ||
|
||
/// impl Foo priv | ||
impl Foo { | ||
fn baz() {} | ||
} | ||
// @!has '$.index[*][?(@.docs=="impl Foo priv")]' | ||
|
||
|
||
/// impl Foo pub | ||
impl Foo { | ||
pub fn qux() {} | ||
} | ||
// @is '$.index[*][?(@.docs=="impl Foo pub")].visibility' '"default"' | ||
|
||
|
||
/// impl Foo hidden | ||
impl Foo { | ||
#[doc(hidden)] | ||
pub fn __quazl(){} | ||
} | ||
// FIXME(#111564): Is this the right behaviour? | ||
// @is '$.index[*][?(@.docs=="impl Foo hidden")].visibility' '"default"' |
28 changes: 28 additions & 0 deletions
28
tests/rustdoc-json/impls/impl_item_visibility_show_hidden.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// compile-flags: --document-hidden-items | ||
#![feature(no_core)] | ||
#![no_core] | ||
|
||
pub struct Foo; | ||
|
||
/// impl Foo priv | ||
impl Foo { | ||
fn baz() {} | ||
} | ||
// FIXME(#111564): Is this the right behaviour? | ||
// @is '$.index[*][?(@.docs=="impl Foo priv")].visibility' '"default"' | ||
|
||
|
||
/// impl Foo pub | ||
impl Foo { | ||
pub fn qux() {} | ||
} | ||
// @is '$.index[*][?(@.docs=="impl Foo pub")].visibility' '"default"' | ||
|
||
|
||
/// impl Foo hidden | ||
impl Foo { | ||
#[doc(hidden)] | ||
pub fn __quazl(){} | ||
} | ||
// FIXME(#111564): Is this the right behaviour? | ||
// @is '$.index[*][?(@.docs=="impl Foo hidden")].visibility' '"default"' |
27 changes: 27 additions & 0 deletions
27
tests/rustdoc-json/impls/impl_item_visibility_show_private.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// compile-flags: --document-private-items | ||
#![feature(no_core)] | ||
#![no_core] | ||
|
||
pub struct Foo; | ||
|
||
/// impl Foo priv | ||
impl Foo { | ||
fn baz() {} | ||
} | ||
// @is '$.index[*][?(@.docs=="impl Foo priv")].visibility' '"default"' | ||
|
||
|
||
/// impl Foo pub | ||
impl Foo { | ||
pub fn qux() {} | ||
} | ||
// @is '$.index[*][?(@.docs=="impl Foo pub")].visibility' '"default"' | ||
|
||
|
||
/// impl Foo hidden | ||
impl Foo { | ||
#[doc(hidden)] | ||
pub fn __quazl(){} | ||
} | ||
// FIXME(#111564): Is this the right behaviour? | ||
// @is '$.index[*][?(@.docs=="impl Foo hidden")].visibility' '"default"' |