about summary refs log tree commit diff
path: root/tests/rustdoc-ui/doctest/warn-main-not-called.rs
blob: ec762486d5d423751fec5fde77a7d768e3ab1b6b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
//@ check-pass
//@ compile-flags:--test --test-args --test-threads=1
//@ normalize-stdout: "tests/rustdoc-ui/doctest" -> "$$DIR"
//@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME"

// In case there is a `main` function in the doctest alongside expressions,
// the whole doctest will be wrapped into a function and the `main` function
// won't be called.

//! ```
//~^ WARN the `main` function of this doctest won't be run
//! macro_rules! bla {
//!     ($($x:tt)*) => {}
//! }
//!
//! let x = 12;
//! bla!(fn main ());
//! ```
//!
//! ```
//~^^ WARN the `main` function of this doctest won't be run
//! let x = 12;
//! fn main() {}
//! ```