about summary refs log tree commit diff
path: root/tests/rustdoc-ui/doctest/macro-after-main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/rustdoc-ui/doctest/macro-after-main.rs')
-rw-r--r--tests/rustdoc-ui/doctest/macro-after-main.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/rustdoc-ui/doctest/macro-after-main.rs b/tests/rustdoc-ui/doctest/macro-after-main.rs
new file mode 100644
index 00000000000..0a42343f1c2
--- /dev/null
+++ b/tests/rustdoc-ui/doctest/macro-after-main.rs
@@ -0,0 +1,16 @@
+// This test checks a corner case where the macro calls used to be skipped,
+// making them considered as statement, and therefore some cases where
+// `include!` macro was then put into a function body, making the doctest
+// compilation fail.
+
+//@ compile-flags:--test
+//@ normalize-stdout: "tests/rustdoc-ui/doctest" -> "$$DIR"
+//@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME"
+//@ check-pass
+
+//! ```
+//! include!("./auxiliary/macro-after-main.rs");
+//!
+//! fn main() {}
+//! eprintln!();
+//! ```