Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add run-make test for - for -o option
  • Loading branch information
GuillaumeGomez committed Aug 12, 2024
commit 7882575a8cfaa322dddb1fcf3261b470ca485ead
1 change: 1 addition & 0 deletions tests/run-make/rustdoc-output-stdout/foo.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub struct Foo;
25 changes: 25 additions & 0 deletions tests/run-make/rustdoc-output-stdout/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// This test verifies that rustdoc `-o -` prints JSON on stdout and doesn't generate
// a JSON file.

use std::path::PathBuf;

use run_make_support::path_helpers::{cwd, has_extension, read_dir_entries_recursive};
use run_make_support::rustdoc;

fn main() {
// First we check that we generate the JSON in the stdout.
rustdoc()
.input("foo.rs")
.output("-")
.arg("-Zunstable-options")
.output_format("json")
.run()
.assert_stdout_contains("{\"");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remark: I suppose this is a reasonable heuristic.


// Then we check it didn't generate any JSON file.
read_dir_entries_recursive(cwd(), |path| {
if path.is_file() && has_extension(path, "json") {
panic!("Found a JSON file {path:?}");
}
});
}