(cherry picked from commit 81438c0b05)
This commit is contained in:
parent
0457f2e927
commit
745d54e5b2
2 changed files with 28 additions and 0 deletions
22
tests/rustdoc-ui/doctest/test-main-alongside-exprs.rs
Normal file
22
tests/rustdoc-ui/doctest/test-main-alongside-exprs.rs
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
// This test ensures that if there is an expression alongside a `main`
|
||||
// function, it will not consider the entire code to be part of the `main`
|
||||
// function and will generate its own function to wrap everything.
|
||||
//
|
||||
// This is a regression test for:
|
||||
// * <https://github.com/rust-lang/rust/issues/140162>
|
||||
// * <https://github.com/rust-lang/rust/issues/139651>
|
||||
//@ compile-flags:--test
|
||||
//@ normalize-stdout: "tests/rustdoc-ui/doctest" -> "$$DIR"
|
||||
//@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME"
|
||||
//@ check-pass
|
||||
|
||||
#![crate_name = "foo"]
|
||||
|
||||
//! ```
|
||||
//! # if cfg!(miri) { return; }
|
||||
//! use std::ops::Deref;
|
||||
//!
|
||||
//! fn main() {
|
||||
//! println!("Hi!");
|
||||
//! }
|
||||
//! ```
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
|
||||
running 1 test
|
||||
test $DIR/test-main-alongside-exprs.rs - (line 15) ... ok
|
||||
|
||||
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue