about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume.gomez@huawei.com>2023-04-13 13:19:00 +0200
committerGuillaume Gomez <guillaume.gomez@huawei.com>2023-04-13 20:35:05 +0200
commit80c43232177c1a04ef11bd8103b56b67f69b669c (patch)
tree7f8679062a08fedfb1b0f5950c75e49b5f3ed3af
parent5e51b2d9688ccdfb082a1b855c9aa8398b86b870 (diff)
downloadrust-80c43232177c1a04ef11bd8103b56b67f69b669c.tar.gz
rust-80c43232177c1a04ef11bd8103b56b67f69b669c.zip
Add test to ensure that compiler built-in proc-macro are considered as such
-rw-r--r--tests/rustdoc/compiler-derive-proc-macro.rs15
-rw-r--r--tests/rustdoc/macro_pub_in_module.rs12
2 files changed, 23 insertions, 4 deletions
diff --git a/tests/rustdoc/compiler-derive-proc-macro.rs b/tests/rustdoc/compiler-derive-proc-macro.rs
new file mode 100644
index 00000000000..489ec924c1f
--- /dev/null
+++ b/tests/rustdoc/compiler-derive-proc-macro.rs
@@ -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;
diff --git a/tests/rustdoc/macro_pub_in_module.rs b/tests/rustdoc/macro_pub_in_module.rs
index 4fd85d68994..42f760cff6a 100644
--- a/tests/rustdoc/macro_pub_in_module.rs
+++ b/tests/rustdoc/macro_pub_in_module.rs
@@ -7,8 +7,8 @@
 #![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 {
@@ -16,13 +16,17 @@ pub mod inner {
     // @!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) {}