rustdoc: Rename unstable option --nocapture to --no-capture
This commit is contained in:
parent
04ff05c9c0
commit
11b82e134c
13 changed files with 22 additions and 22 deletions
|
|
@ -362,7 +362,7 @@ Using `index-page` option enables `enable-index-page` option as well.
|
|||
|
||||
This feature allows the generation of a default index-page which lists the generated crates.
|
||||
|
||||
## `--nocapture`: disable output capture for test
|
||||
## `--no-capture`: disable output capture for test
|
||||
|
||||
When this flag is used with `--test`, the output (stdout and stderr) of your tests won't be
|
||||
captured by rustdoc. Instead, the output will be directed to your terminal,
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ pub(crate) struct Options {
|
|||
/// Whether doctests should emit unused externs
|
||||
pub(crate) json_unused_externs: JsonUnusedExterns,
|
||||
/// Whether to skip capturing stdout and stderr of tests.
|
||||
pub(crate) nocapture: bool,
|
||||
pub(crate) no_capture: bool,
|
||||
|
||||
/// Configuration for scraping examples from the current crate. If this option is Some(..) then
|
||||
/// the compiler will scrape examples and not generate documentation.
|
||||
|
|
@ -211,7 +211,7 @@ impl fmt::Debug for Options {
|
|||
.field("no_run", &self.no_run)
|
||||
.field("test_builder_wrappers", &self.test_builder_wrappers)
|
||||
.field("remap-file-prefix", &self.remap_path_prefix)
|
||||
.field("nocapture", &self.nocapture)
|
||||
.field("no_capture", &self.no_capture)
|
||||
.field("scrape_examples_options", &self.scrape_examples_options)
|
||||
.field("unstable_features", &self.unstable_features)
|
||||
.finish()
|
||||
|
|
@ -785,7 +785,7 @@ impl Options {
|
|||
let run_check = matches.opt_present("check");
|
||||
let generate_redirect_map = matches.opt_present("generate-redirect-map");
|
||||
let show_type_layout = matches.opt_present("show-type-layout");
|
||||
let nocapture = matches.opt_present("nocapture");
|
||||
let no_capture = matches.opt_present("no-capture");
|
||||
let generate_link_to_definition = matches.opt_present("generate-link-to-definition");
|
||||
let generate_macro_expansion = matches.opt_present("generate-macro-expansion");
|
||||
let extern_html_root_takes_precedence =
|
||||
|
|
@ -856,7 +856,7 @@ impl Options {
|
|||
no_run,
|
||||
test_builder_wrappers,
|
||||
remap_path_prefix,
|
||||
nocapture,
|
||||
no_capture,
|
||||
crate_name,
|
||||
output_format,
|
||||
json_unused_externs,
|
||||
|
|
|
|||
|
|
@ -326,8 +326,8 @@ pub(crate) fn run_tests(
|
|||
let mut test_args = Vec::with_capacity(rustdoc_options.test_args.len() + 1);
|
||||
test_args.insert(0, "rustdoctest".to_string());
|
||||
test_args.extend_from_slice(&rustdoc_options.test_args);
|
||||
if rustdoc_options.nocapture {
|
||||
test_args.push("--nocapture".to_string());
|
||||
if rustdoc_options.no_capture {
|
||||
test_args.push("--no-capture".to_string());
|
||||
}
|
||||
|
||||
let mut nb_errors = 0;
|
||||
|
|
@ -644,8 +644,8 @@ fn run_test(
|
|||
// tested as standalone tests.
|
||||
return (Duration::default(), Err(TestFailure::CompileError));
|
||||
}
|
||||
if !rustdoc_options.nocapture {
|
||||
// If `nocapture` is disabled, then we don't display rustc's output when compiling
|
||||
if !rustdoc_options.no_capture {
|
||||
// If `no_capture` is disabled, then we don't display rustc's output when compiling
|
||||
// the merged doctests.
|
||||
compiler.stderr(Stdio::null());
|
||||
}
|
||||
|
|
@ -721,8 +721,8 @@ fn run_test(
|
|||
// tested as standalone tests.
|
||||
return (instant.elapsed(), Err(TestFailure::CompileError));
|
||||
}
|
||||
if !rustdoc_options.nocapture {
|
||||
// If `nocapture` is disabled, then we don't display rustc's output when compiling
|
||||
if !rustdoc_options.no_capture {
|
||||
// If `no_capture` is disabled, then we don't display rustc's output when compiling
|
||||
// the merged doctests.
|
||||
runner_compiler.stderr(Stdio::null());
|
||||
}
|
||||
|
|
@ -821,7 +821,7 @@ fn run_test(
|
|||
cmd.current_dir(run_directory);
|
||||
}
|
||||
|
||||
let result = if doctest.is_multiple_tests() || rustdoc_options.nocapture {
|
||||
let result = if doctest.is_multiple_tests() || rustdoc_options.no_capture {
|
||||
cmd.status().map(|status| process::Output {
|
||||
status,
|
||||
stdout: Vec::new(),
|
||||
|
|
@ -1016,7 +1016,7 @@ impl CreateRunnableDocTests {
|
|||
.span(scraped_test.span)
|
||||
.build(dcx);
|
||||
let is_standalone = !doctest.can_be_merged
|
||||
|| self.rustdoc_options.nocapture
|
||||
|| self.rustdoc_options.no_capture
|
||||
|| self.rustdoc_options.test_args.iter().any(|arg| arg == "--show-output");
|
||||
if is_standalone {
|
||||
let test_desc = self.generate_test_desc_and_fn(doctest, scraped_test);
|
||||
|
|
|
|||
|
|
@ -585,7 +585,7 @@ fn opts() -> Vec<RustcOptGroup> {
|
|||
"Include the memory layout of types in the docs",
|
||||
"",
|
||||
),
|
||||
opt(Unstable, Flag, "", "nocapture", "Don't capture stdout and stderr of tests", ""),
|
||||
opt(Unstable, Flag, "", "no-capture", "Don't capture stdout and stderr of tests", ""),
|
||||
opt(
|
||||
Unstable,
|
||||
Flag,
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ Options:
|
|||
Remap source names in compiler messages
|
||||
--show-type-layout
|
||||
Include the memory layout of types in the docs
|
||||
--nocapture Don't capture stdout and stderr of tests
|
||||
--no-capture Don't capture stdout and stderr of tests
|
||||
--generate-link-to-definition
|
||||
Make the identifiers in the HTML source code pages
|
||||
navigable
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
//@ check-pass
|
||||
//@ compile-flags: --test --nocapture --check-cfg=cfg(feature,values("test")) -Z unstable-options
|
||||
//@ compile-flags: --test --no-capture --check-cfg=cfg(feature,values("test")) -Z unstable-options
|
||||
//@ normalize-stderr: "tests/rustdoc-ui/doctest" -> "$$DIR"
|
||||
//@ normalize-stdout: "tests/rustdoc-ui/doctest" -> "$$DIR"
|
||||
//@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
//@ check-pass
|
||||
//@ compile-flags:--test -Zunstable-options --nocapture
|
||||
//@ compile-flags:--test -Zunstable-options --no-capture
|
||||
//@ normalize-stderr: "tests/rustdoc-ui/doctest" -> "$$DIR"
|
||||
//@ normalize-stdout: "tests/rustdoc-ui/doctest" -> "$$DIR"
|
||||
//@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME"
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
error: struct literal body without path
|
||||
--> $DIR/nocapture-fail.rs:8:10
|
||||
--> $DIR/no-capture-fail.rs:8:10
|
||||
|
|
||||
LL | fn foo() {
|
||||
| __________^
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
running 1 test
|
||||
test $DIR/nocapture-fail.rs - Foo (line 7) - compile fail ... ok
|
||||
test $DIR/no-capture-fail.rs - Foo (line 7) - compile fail ... ok
|
||||
|
||||
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
|
||||
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
//@ check-pass
|
||||
//@ compile-flags:--test -Zunstable-options --nocapture
|
||||
//@ compile-flags:--test -Zunstable-options --no-capture
|
||||
//@ normalize-stdout: "tests/rustdoc-ui/doctest" -> "$$DIR"
|
||||
//@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME"
|
||||
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
running 1 test
|
||||
hello!
|
||||
test $DIR/nocapture.rs - Foo (line 6) ... ok
|
||||
test $DIR/no-capture.rs - Foo (line 6) ... ok
|
||||
|
||||
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
|
||||
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
//@ check-pass
|
||||
//@ compile-flags:--test --test-args --test-threads=1 --nocapture -Zunstable-options
|
||||
//@ compile-flags:--test --test-args --test-threads=1 --no-capture -Zunstable-options
|
||||
//@ normalize-stdout: "tests/rustdoc-ui/doctest" -> "$$DIR"
|
||||
//@ normalize-stderr: "tests/rustdoc-ui/doctest" -> "$$DIR"
|
||||
//@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue