Files
rust/tests/rustdoc-ui/doctest/warn-main-not-called.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

25 lines
659 B
Rust
Raw Normal View History

2025-04-30 20:38:12 +02:00
//@ 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
2025-04-30 20:38:12 +02:00
//! macro_rules! bla {
//! ($($x:tt)*) => {}
//! }
//!
//! let x = 12;
//! bla!(fn main ());
//! ```
//!
//! ```
//~^^ WARN the `main` function of this doctest won't be run
2025-04-30 20:38:12 +02:00
//! let x = 12;
//! fn main() {}
//! ```