diff options
| author | Guillaume Gomez <guillaume.gomez@huawei.com> | 2024-08-12 14:20:21 +0200 |
|---|---|---|
| committer | Guillaume Gomez <guillaume.gomez@huawei.com> | 2024-08-12 14:40:19 +0200 |
| commit | 7882575a8cfaa322dddb1fcf3261b470ca485ead (patch) | |
| tree | 06a11164fd51df3f1e6cf854e22a4e95bd666bd1 | |
| parent | e2fd0c0f9affa65bf2291a83d48b16919d59fd7c (diff) | |
| download | rust-7882575a8cfaa322dddb1fcf3261b470ca485ead.tar.gz rust-7882575a8cfaa322dddb1fcf3261b470ca485ead.zip | |
Add `run-make` test for `-` for `-o` option
| -rw-r--r-- | tests/run-make/rustdoc-output-stdout/foo.rs | 1 | ||||
| -rw-r--r-- | tests/run-make/rustdoc-output-stdout/rmake.rs | 25 |
2 files changed, 26 insertions, 0 deletions
diff --git a/tests/run-make/rustdoc-output-stdout/foo.rs b/tests/run-make/rustdoc-output-stdout/foo.rs new file mode 100644 index 00000000000..4a835673a59 --- /dev/null +++ b/tests/run-make/rustdoc-output-stdout/foo.rs @@ -0,0 +1 @@ +pub struct Foo; diff --git a/tests/run-make/rustdoc-output-stdout/rmake.rs b/tests/run-make/rustdoc-output-stdout/rmake.rs new file mode 100644 index 00000000000..e7dfb66602c --- /dev/null +++ b/tests/run-make/rustdoc-output-stdout/rmake.rs @@ -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("{\""); + + // 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:?}"); + } + }); +} |
