mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
Add test to ensure passing --doctest_compilation_args
multiple times work
This commit is contained in:
parent
bc03e40a29
commit
2d914bed2d
@ -667,7 +667,7 @@ This flag can be passed multiple times to nest wrappers.
|
||||
|
||||
## Passing arguments to rustc when compiling doctests
|
||||
|
||||
You can use the `--doctest-compilation-args` option if you want to add options when compiling the
|
||||
You can use the `--doctest-compilation-args` flag if you want to add options when compiling the
|
||||
doctest. For example if you have:
|
||||
|
||||
```rust,no_run
|
||||
|
17
tests/rustdoc-ui/doctest/rustflags-multiple-args.rs
Normal file
17
tests/rustdoc-ui/doctest/rustflags-multiple-args.rs
Normal file
@ -0,0 +1,17 @@
|
||||
// This test checks that the test behave when `--doctest-compilation-args` is passed
|
||||
// multiple times.
|
||||
|
||||
//@ check-pass
|
||||
//@ compile-flags: --test -Zunstable-options --doctest-compilation-args=--cfg=testcase_must_be_present
|
||||
//@ compile-flags: --doctest-compilation-args=--cfg=another
|
||||
//@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR"
|
||||
//@ normalize-stdout-test: "finished in \d+\.\d+s" -> "finished in $$TIME"
|
||||
|
||||
/// ```
|
||||
/// #[cfg(testcase_must_be_present)]
|
||||
/// #[cfg(another)]
|
||||
/// fn must_be_present() {}
|
||||
///
|
||||
/// fn main() { must_be_present() }
|
||||
/// ```
|
||||
pub struct Bar;
|
6
tests/rustdoc-ui/doctest/rustflags-multiple-args.stdout
Normal file
6
tests/rustdoc-ui/doctest/rustflags-multiple-args.stdout
Normal file
@ -0,0 +1,6 @@
|
||||
|
||||
running 1 test
|
||||
test $DIR/rustflags-multiple-args.rs - Bar (line 10) ... ok
|
||||
|
||||
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
|
||||
|
Loading…
Reference in New Issue
Block a user