Skip to content

Commit 4e0541a

Browse files
Add regression test for enable to run compiler in doctest
1 parent 390d8bc commit 4e0541a

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
//! ```
2+
//! let x = 12;
3+
//! ```
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// This test ensures that if the rustdoc test binary is not executable, it will
2+
// gracefully fail and not panic.
3+
4+
//@ needs-target-std
5+
6+
use run_make_support::{path, rfs, rustdoc};
7+
8+
fn main() {
9+
let absolute_path = path("foo.rs").canonicalize().expect("failed to get absolute path");
10+
let output = rustdoc()
11+
.input("foo.rs")
12+
.arg("--test")
13+
.arg("-Zunstable-options")
14+
.arg("--test-builder")
15+
.arg(&absolute_path)
16+
.run_fail();
17+
18+
output.assert_stdout_contains("Failed to run compiler: ");
19+
output.assert_stderr_not_contains("the compiler unexpectedly panicked. this is a bug.");
20+
// Just in case...
21+
output.assert_stdout_not_contains("the compiler unexpectedly panicked. this is a bug.");
22+
}

0 commit comments

Comments
 (0)