Skip to content

Commit 81438c0

Browse files
Add regression ui test for rust-lang#140162 and for rust-lang#139651
1 parent 3536324 commit 81438c0

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// This test ensures that if there is an expression alongside a `main`
2+
// function, it will not consider the entire code to be part of the `main`
3+
// function and will generate its own function to wrap everything.
4+
//
5+
// This is a regression test for:
6+
// * <https://github.com/rust-lang/rust/issues/140162>
7+
// * <https://github.com/rust-lang/rust/issues/139651>
8+
//@ compile-flags:--test
9+
//@ normalize-stdout: "tests/rustdoc-ui/doctest" -> "$$DIR"
10+
//@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME"
11+
//@ check-pass
12+
13+
#![crate_name = "foo"]
14+
15+
//! ```
16+
//! # if cfg!(miri) { return; }
17+
//! use std::ops::Deref;
18+
//!
19+
//! fn main() {
20+
//! println!("Hi!");
21+
//! }
22+
//! ```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
running 1 test
3+
test $DIR/test-main-alongside-exprs.rs - (line 15) ... ok
4+
5+
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
6+

0 commit comments

Comments
 (0)