Skip to content

Commit 7882575

Browse files
Add run-make test for - for -o option
1 parent e2fd0c0 commit 7882575

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pub struct Foo;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// This test verifies that rustdoc `-o -` prints JSON on stdout and doesn't generate
2+
// a JSON file.
3+
4+
use std::path::PathBuf;
5+
6+
use run_make_support::path_helpers::{cwd, has_extension, read_dir_entries_recursive};
7+
use run_make_support::rustdoc;
8+
9+
fn main() {
10+
// First we check that we generate the JSON in the stdout.
11+
rustdoc()
12+
.input("foo.rs")
13+
.output("-")
14+
.arg("-Zunstable-options")
15+
.output_format("json")
16+
.run()
17+
.assert_stdout_contains("{\"");
18+
19+
// Then we check it didn't generate any JSON file.
20+
read_dir_entries_recursive(cwd(), |path| {
21+
if path.is_file() && has_extension(path, "json") {
22+
panic!("Found a JSON file {path:?}");
23+
}
24+
});
25+
}

0 commit comments

Comments
 (0)