Skip to content

Commit 0a01e8e

Browse files
Add regression test for #143858
1 parent d67a4a5 commit 0a01e8e

File tree

3 files changed

+74
-0
lines changed

3 files changed

+74
-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 14) - compile ... ok
4+
test $DIR/no-run.rs - f (line 17) - compile ... ok
5+
test $DIR/no-run.rs - f (line 20) ... ignored
6+
test $DIR/no-run.rs - f (line 23) - compile ... ok
7+
test $DIR/no-run.rs - f (line 29) - compile fail ... ok
8+
test $DIR/no-run.rs - f (line 34) - compile ... ok
9+
test $DIR/no-run.rs - f (line 38) - compile ... ok
10+
11+
test result: ok. 6 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in $TIME
12+
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
2+
running 5 tests
3+
test $DIR/no-run.rs - f (line 14) - compile ... ok
4+
test $DIR/no-run.rs - f (line 17) - compile ... ok
5+
test $DIR/no-run.rs - f (line 23) - compile ... ok
6+
test $DIR/no-run.rs - f (line 34) - compile ... ok
7+
test $DIR/no-run.rs - f (line 38) - 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 20) ... ignored
14+
test $DIR/no-run.rs - f (line 29) - compile fail ... ok
15+
16+
test result: ok. 1 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in $TIME
17+
18+
all doctests ran in $TIME; merged doctests compilation took $TIME

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

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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+
//@ normalize-stdout: "ran in \d+\.\d+s" -> "ran in $$TIME"
12+
//@ normalize-stdout: "compilation took \d+\.\d+s" -> "compilation took $$TIME"
13+
14+
/// ```
15+
/// let a = true;
16+
/// ```
17+
/// ```should_panic
18+
/// panic!()
19+
/// ```
20+
/// ```ignore (incomplete-code)
21+
/// fn foo() {
22+
/// ```
23+
/// ```no_run
24+
/// loop {
25+
/// println!("Hello, world");
26+
/// }
27+
/// ```
28+
/// fails to compile
29+
/// ```compile_fail
30+
/// let x = 5;
31+
/// x += 2; // shouldn't compile!
32+
/// ```
33+
/// Ok the test does not run
34+
/// ```
35+
/// panic!()
36+
/// ```
37+
/// Ok the test does not run
38+
/// ```should_panic
39+
/// loop {
40+
/// println!("Hello, world");
41+
/// panic!()
42+
/// }
43+
/// ```
44+
pub fn f() {}

0 commit comments

Comments
 (0)