Skip to content

Commit 27fb02c

Browse files
committed
Add rustdoc JSON tests for #[doc(hidden)] handling of items.
1 parent ab68b0f commit 27fb02c

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#![no_std]
2+
3+
// Without `--document-hidden-items`,
4+
// none of these items are present in rustdoc JSON.
5+
6+
//@ !has "$.index[?(@.name=='func')]"
7+
#[doc(hidden)]
8+
pub fn func() {}
9+
10+
//@ !has "$.index[?(@.name=='Unit')]"
11+
#[doc(hidden)]
12+
pub struct Unit;
13+
14+
//@ !has "$.index[?(@.name=='hidden')]"
15+
#[doc(hidden)]
16+
pub mod hidden {
17+
//@ !has "$.index[?(@.name=='Inner')]"
18+
pub struct Inner;
19+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//@ compile-flags: --document-hidden-items
2+
#![no_std]
3+
4+
//@ is "$.index[?(@.name=='func')].attrs" '["#[doc(hidden)]"]'
5+
#[doc(hidden)]
6+
pub fn func() {}
7+
8+
//@ is "$.index[?(@.name=='Unit')].attrs" '["#[doc(hidden)]"]'
9+
#[doc(hidden)]
10+
pub struct Unit;
11+
12+
//@ is "$.index[?(@.name=='hidden')].attrs" '["#[doc(hidden)]"]'
13+
#[doc(hidden)]
14+
pub mod hidden {
15+
//@ is "$.index[?(@.name=='Inner')].attrs" '[]'
16+
pub struct Inner;
17+
}

0 commit comments

Comments
 (0)