Skip to content

Commit 5d72429

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

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-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,19 @@
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::rustdoc;
7+
use run_make_support::path_helpers::{has_extension, path, read_dir_entries_recursive};
8+
9+
fn main() {
10+
// First we check that we generate the JSON in the stdout.
11+
rustdoc().input("foo.rs").output("-").arg("-Zunstable-options").output_format("json").run().assert_stdout_contains("{\"");
12+
13+
// Then we check it didn't generate any JSON file.
14+
read_dir_entries_recursive(path(""), |path| {
15+
if path.is_file() && has_extension(path, "json") {
16+
panic!("Found a JSON file {path:?}");
17+
}
18+
});
19+
}

0 commit comments

Comments
 (0)