Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rustdoc-json: Add tests for visibility of impls #111565

Merged
merged 1 commit into from
May 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions tests/rustdoc-json/impls/impl_item_visibility.rs
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 tests/rustdoc-json/impls/impl_item_visibility_show_hidden.rs
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 tests/rustdoc-json/impls/impl_item_visibility_show_private.rs
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"'