Skip to content

Commit

Permalink
Add test to ensure that compiler built-in proc-macro are considered a…
Browse files Browse the repository at this point in the history
…s such
  • Loading branch information
GuillaumeGomez committed Apr 13, 2023
1 parent 5e51b2d commit 80c4323
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
15 changes: 15 additions & 0 deletions tests/rustdoc/compiler-derive-proc-macro.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// This test ensures that compiler builtin proc-macros are considered as such.

#![crate_name = "foo"]

// @has 'foo/index.html'
// Each compiler builtin proc-macro has a trait equivalent so we should have
// a trait section as well.
// @count - '//*[@id="main-content"]//*[@class="small-section-header"]' 2
// @has - '//*[@id="main-content"]//*[@class="small-section-header"]' 'Traits'
// @has - '//*[@id="main-content"]//*[@class="small-section-header"]' 'Derive Macros'

// Now checking the correct file is generated as well.
// @has 'foo/derive.Clone.html'
// @!has 'foo/macro.Clone.html'
pub use std::clone::Clone;
12 changes: 8 additions & 4 deletions tests/rustdoc/macro_pub_in_module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,26 @@
#![crate_name = "krate"]
#![no_core]

// @has external_crate/some_module/macro.external_macro.html
// @!has external_crate/macro.external_macro.html
// @has external_crate/some_module/macro.external_macro.html
// @!has external_crate/macro.external_macro.html
extern crate external_crate;

pub mod inner {
// @has krate/inner/macro.raw_const.html
// @!has krate/macro.raw_const.html
pub macro raw_const() {}

// @has krate/inner/macro.test.html
// @has krate/inner/attr.test.html
// @!has krate/macro.test.html
// @!has krate/inner/macro.test.html
// @!has krate/attr.test.html
#[rustc_builtin_macro]
pub macro test($item:item) {}

// @has krate/inner/macro.Clone.html
// @has krate/inner/derive.Clone.html
// @!has krate/inner/macro.Clone.html
// @!has krate/macro.Clone.html
// @!has krate/derive.Clone.html
#[rustc_builtin_macro]
pub macro Clone($item:item) {}

Expand Down

0 comments on commit 80c4323

Please sign in to comment.