From 3ee84983f1a0cf1fe0be0d0fb024be9e2eb6fd13 Mon Sep 17 00:00:00 2001 From: Alona Enraght-Moony Date: Fri, 24 May 2024 16:40:20 +0000 Subject: [PATCH] rustdoc-json: Add test for keywords with `--document-private-items` --- tests/rustdoc-json/keyword_private.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 tests/rustdoc-json/keyword_private.rs diff --git a/tests/rustdoc-json/keyword_private.rs b/tests/rustdoc-json/keyword_private.rs new file mode 100644 index 00000000000..1c2b7d02155 --- /dev/null +++ b/tests/rustdoc-json/keyword_private.rs @@ -0,0 +1,20 @@ +// Ensure keyword docs are present with --document-private-items + +//@ compile-flags: --document-private-items +#![feature(rustdoc_internals)] + +// @!has "$.index[*][?(@.name=='match')]" +// @has "$.index[*][?(@.name=='foo')]" +// @is "$.index[*][?(@.name=='foo')].attrs" '["#[doc(keyword = \"match\")]"]' +// @is "$.index[*][?(@.name=='foo')].docs" '"this is a test!"' +#[doc(keyword = "match")] +/// this is a test! +pub mod foo {} + +// @!has "$.index[*][?(@.name=='hello')]" +// @has "$.index[*][?(@.name=='bar')]" +// @is "$.index[*][?(@.name=='bar')].attrs" '["#[doc(keyword = \"hello\")]"]' +// @is "$.index[*][?(@.name=='bar')].docs" '"hello"' +#[doc(keyword = "hello")] +/// hello +mod bar {}