diff options
| author | Predrag Gruevski <obi1kenobi82@gmail.com> | 2025-07-09 01:32:23 +0000 |
|---|---|---|
| committer | Predrag Gruevski <obi1kenobi82@gmail.com> | 2025-07-10 00:19:03 +0000 |
| commit | 27fb02c947a3aec673364ee555c0c24d8215b7c7 (patch) | |
| tree | 998a5c4ebe2ba354c0381a8300c84c378f9cad3e /tests/rustdoc-json | |
| parent | ab68b0fb26485ab1fa6977b2d8b59cc8a171c4aa (diff) | |
| download | rust-27fb02c947a3aec673364ee555c0c24d8215b7c7.tar.gz rust-27fb02c947a3aec673364ee555c0c24d8215b7c7.zip | |
Add rustdoc JSON tests for `#[doc(hidden)]` handling of items.
Diffstat (limited to 'tests/rustdoc-json')
| -rw-r--r-- | tests/rustdoc-json/visibility/doc_hidden_default.rs | 19 | ||||
| -rw-r--r-- | tests/rustdoc-json/visibility/doc_hidden_documented.rs | 17 |
2 files changed, 36 insertions, 0 deletions
diff --git a/tests/rustdoc-json/visibility/doc_hidden_default.rs b/tests/rustdoc-json/visibility/doc_hidden_default.rs new file mode 100644 index 00000000000..3fa91b3c4ad --- /dev/null +++ b/tests/rustdoc-json/visibility/doc_hidden_default.rs @@ -0,0 +1,19 @@ +#![no_std] + +// Without `--document-hidden-items`, +// none of these items are present in rustdoc JSON. + +//@ !has "$.index[?(@.name=='func')]" +#[doc(hidden)] +pub fn func() {} + +//@ !has "$.index[?(@.name=='Unit')]" +#[doc(hidden)] +pub struct Unit; + +//@ !has "$.index[?(@.name=='hidden')]" +#[doc(hidden)] +pub mod hidden { + //@ !has "$.index[?(@.name=='Inner')]" + pub struct Inner; +} diff --git a/tests/rustdoc-json/visibility/doc_hidden_documented.rs b/tests/rustdoc-json/visibility/doc_hidden_documented.rs new file mode 100644 index 00000000000..6e9ef48680b --- /dev/null +++ b/tests/rustdoc-json/visibility/doc_hidden_documented.rs @@ -0,0 +1,17 @@ +//@ compile-flags: --document-hidden-items +#![no_std] + +//@ is "$.index[?(@.name=='func')].attrs" '["#[doc(hidden)]"]' +#[doc(hidden)] +pub fn func() {} + +//@ is "$.index[?(@.name=='Unit')].attrs" '["#[doc(hidden)]"]' +#[doc(hidden)] +pub struct Unit; + +//@ is "$.index[?(@.name=='hidden')].attrs" '["#[doc(hidden)]"]' +#[doc(hidden)] +pub mod hidden { + //@ is "$.index[?(@.name=='Inner')].attrs" '[]' + pub struct Inner; +} |
