Skip to content

Commit b559eba

Browse files
Add regression test for rust-lang#131893
1 parent d51fe6e commit b559eba

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//@ check-pass
2+
//@ compile-flags:--test
3+
//@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR"
4+
//@ normalize-stdout-test: "finished in \d+\.\d+s" -> "finished in $$TIME"
5+
6+
// Regression test for <https://github.com/rust-lang/rust/issues/131893>.
7+
// It ensures that if a function called `main` is nested, it will not consider
8+
// it as the `main` function.
9+
10+
/// ```
11+
/// fn dox() {
12+
/// fn main() {}
13+
/// }
14+
/// ```
15+
pub fn foo() {}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
running 1 test
3+
test tests/rustdoc-ui/nested-main-doctest.rs - foo (line 10) ... 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)