Skip to content

Commit 248c61c

Browse files
Add regression test for #143858
1 parent 3f7b989 commit 248c61c

File tree

3 files changed

+71
-0
lines changed

3 files changed

+71
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
running 7 tests
3+
test $DIR/no-run.rs - f (line 12) - compile ... ok
4+
test $DIR/no-run.rs - f (line 15) - compile ... ok
5+
test $DIR/no-run.rs - f (line 18) ... ignored
6+
test $DIR/no-run.rs - f (line 21) - compile ... ok
7+
test $DIR/no-run.rs - f (line 27) - compile fail ... ok
8+
test $DIR/no-run.rs - f (line 32) - compile ... ok
9+
test $DIR/no-run.rs - f (line 36) - compile ... ok
10+
11+
test result: ok. 6 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in $TIME
12+
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
running 5 tests
3+
test $DIR/no-run.rs - f (line 12) - compile ... ok
4+
test $DIR/no-run.rs - f (line 15) - compile ... ok
5+
test $DIR/no-run.rs - f (line 21) - compile ... ok
6+
test $DIR/no-run.rs - f (line 32) - compile ... ok
7+
test $DIR/no-run.rs - f (line 36) - compile ... ok
8+
9+
test result: ok. 5 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
10+
11+
12+
running 2 tests
13+
test $DIR/no-run.rs - f (line 18) ... ignored
14+
test $DIR/no-run.rs - f (line 27) - compile fail ... ok
15+
16+
test result: ok. 1 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in $TIME
17+

tests/rustdoc-ui/doctest/no-run.rs

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// This test ensures that the `--no-run` flag works the same between normal and merged doctests.
2+
// Regression test for <https://github.com/rust-lang/rust/issues/143858>.
3+
4+
//@ check-pass
5+
//@ revisions: edition2021 edition2024
6+
//@ [edition2021]edition:2021
7+
//@ [edition2024]edition:2024
8+
//@ compile-flags:-Z unstable-options --test --no-run --test-args=--test-threads=1
9+
//@ normalize-stdout: "tests/rustdoc-ui/doctest" -> "$$DIR"
10+
//@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME"
11+
12+
/// ```
13+
/// let a = true;
14+
/// ```
15+
/// ```should_panic
16+
/// panic!()
17+
/// ```
18+
/// ```ignore (incomplete-code)
19+
/// fn foo() {
20+
/// ```
21+
/// ```no_run
22+
/// loop {
23+
/// println!("Hello, world");
24+
/// }
25+
/// ```
26+
/// fails to compile
27+
/// ```compile_fail
28+
/// let x = 5;
29+
/// x += 2; // shouldn't compile!
30+
/// ```
31+
/// Ok the test does not run
32+
/// ```
33+
/// panic!()
34+
/// ```
35+
/// Ok the test does not run
36+
/// ```should_panic
37+
/// loop {
38+
/// println!("Hello, world");
39+
/// panic!()
40+
/// }
41+
/// ```
42+
pub fn f() {}

0 commit comments

Comments
 (0)