From 50dc319ef0adc304ce51317a6ed1bdc6cc369822 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Wed, 20 Oct 2021 15:44:16 +0200 Subject: [PATCH] Add test for duplicated sidebar entries for reexported macro --- src/test/rustdoc-gui/sidebar-macro-reexport.goml | 5 +++++ src/test/rustdoc-gui/sidebar.goml | 13 +++++++------ src/test/rustdoc-gui/src/test_docs/lib.rs | 7 +++++++ 3 files changed, 19 insertions(+), 6 deletions(-) create mode 100644 src/test/rustdoc-gui/sidebar-macro-reexport.goml diff --git a/src/test/rustdoc-gui/sidebar-macro-reexport.goml b/src/test/rustdoc-gui/sidebar-macro-reexport.goml new file mode 100644 index 00000000000..a3a62fe5446 --- /dev/null +++ b/src/test/rustdoc-gui/sidebar-macro-reexport.goml @@ -0,0 +1,5 @@ +// This test ensures that the reexport of a macro doesn't make the original macro +// displayed twice in the sidebar. +goto: file://|DOC_PATH|/test_docs/macro.repro.html +wait-for: ".sidebar-elems .macro .macro" +assert-count: ("//*[@class='sidebar-elems']//*[@class='block macro']//a[text()='repro']", 1) diff --git a/src/test/rustdoc-gui/sidebar.goml b/src/test/rustdoc-gui/sidebar.goml index c8ebb8c56f5..62dc76a40bc 100644 --- a/src/test/rustdoc-gui/sidebar.goml +++ b/src/test/rustdoc-gui/sidebar.goml @@ -7,12 +7,13 @@ assert-text: (".sidebar-elems > #all-types", "See all test_docs's items") assert-text: (".sidebar-elems > .crate > ul > li > a.current", "test_docs") // And we're also supposed to have the list of items in the current module. assert-text: (".sidebar-elems > .items > ul > li:nth-child(1)", "Modules") -assert-text: (".sidebar-elems > .items > ul > li:nth-child(2)", "Structs") -assert-text: (".sidebar-elems > .items > ul > li:nth-child(3)", "Enums") -assert-text: (".sidebar-elems > .items > ul > li:nth-child(4)", "Traits") -assert-text: (".sidebar-elems > .items > ul > li:nth-child(5)", "Functions") -assert-text: (".sidebar-elems > .items > ul > li:nth-child(6)", "Type Definitions") -assert-text: (".sidebar-elems > .items > ul > li:nth-child(7)", "Keywords") +assert-text: (".sidebar-elems > .items > ul > li:nth-child(2)", "Macros") +assert-text: (".sidebar-elems > .items > ul > li:nth-child(3)", "Structs") +assert-text: (".sidebar-elems > .items > ul > li:nth-child(4)", "Enums") +assert-text: (".sidebar-elems > .items > ul > li:nth-child(5)", "Traits") +assert-text: (".sidebar-elems > .items > ul > li:nth-child(6)", "Functions") +assert-text: (".sidebar-elems > .items > ul > li:nth-child(7)", "Type Definitions") +assert-text: (".sidebar-elems > .items > ul > li:nth-child(8)", "Keywords") assert-text: ("#structs + .item-table .item-left > a", "Foo") click: "#structs + .item-table .item-left > a" diff --git a/src/test/rustdoc-gui/src/test_docs/lib.rs b/src/test/rustdoc-gui/src/test_docs/lib.rs index 2a147e64d8b..315ccb6a2b9 100644 --- a/src/test/rustdoc-gui/src/test_docs/lib.rs +++ b/src/test/rustdoc-gui/src/test_docs/lib.rs @@ -123,3 +123,10 @@ pub mod huge_amount_of_consts { /// Very long code text `hereIgoWithLongTextBecauseWhyNotAndWhyWouldntI`. pub mod long_code_block {} + +#[macro_export] +macro_rules! repro { + () => {}; +} + +pub use crate::repro as repro2;