summaryrefslogtreecommitdiffstats
path: root/tests/rustdoc/macro-doc-comment-23812.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/rustdoc/macro-doc-comment-23812.rs')
-rw-r--r--tests/rustdoc/macro-doc-comment-23812.rs39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/rustdoc/macro-doc-comment-23812.rs b/tests/rustdoc/macro-doc-comment-23812.rs
new file mode 100644
index 000000000..57c18510b
--- /dev/null
+++ b/tests/rustdoc/macro-doc-comment-23812.rs
@@ -0,0 +1,39 @@
+// https://github.com/rust-lang/rust/issues/23812
+#![crate_name="issue_23812"]
+
+macro_rules! doc {
+ (#[$outer:meta] mod $i:ident { #![$inner:meta] }) =>
+ (
+ #[$outer]
+ pub mod $i {
+ #![$inner]
+ }
+ )
+}
+
+doc! {
+ /// Outer comment
+ mod Foo {
+ //! Inner comment
+ }
+}
+
+// @has issue_23812/Foo/index.html
+// @hasraw - 'Outer comment'
+// @!hasraw - '/// Outer comment'
+// @hasraw - 'Inner comment'
+// @!hasraw - '//! Inner comment'
+
+
+doc! {
+ /** Outer block comment */
+ mod Bar {
+ /*! Inner block comment */
+ }
+}
+
+// @has issue_23812/Bar/index.html
+// @hasraw - 'Outer block comment'
+// @!hasraw - '/** Outer block comment */'
+// @hasraw - 'Inner block comment'
+// @!hasraw - '/*! Inner block comment */'