diff options
| author | QuietMisdreavus <grey@quietmisdreavus.net> | 2019-06-28 10:31:27 -0500 |
|---|---|---|
| committer | QuietMisdreavus <grey@quietmisdreavus.net> | 2019-07-06 21:37:17 -0500 |
| commit | bed54cf85457d76f479fcd406f07b39c5e8abb12 (patch) | |
| tree | 6f57cc26d9d118bbe1b59afd1e08cebe9659c126 /src/test/rustdoc-ui | |
| parent | b0bd5f236d9bea38b8c9048f379fec179b09984c (diff) | |
rustdoc: set cfg(doctest) when collecting doctests
Diffstat (limited to 'src/test/rustdoc-ui')
| -rw-r--r-- | src/test/rustdoc-ui/cfg-test.rs | 10 | ||||
| -rw-r--r-- | src/test/rustdoc-ui/cfg-test.stdout | 7 |
2 files changed, 14 insertions, 3 deletions
diff --git a/src/test/rustdoc-ui/cfg-test.rs b/src/test/rustdoc-ui/cfg-test.rs index 4dcf512d286..5360354d77a 100644 --- a/src/test/rustdoc-ui/cfg-test.rs +++ b/src/test/rustdoc-ui/cfg-test.rs @@ -5,6 +5,8 @@ // Crates like core have doctests gated on `cfg(not(test))` so we need to make // sure `cfg(test)` is not active when running `rustdoc --test`. +#![feature(cfg_doctest)] + /// this doctest will be ignored: /// /// ``` @@ -20,3 +22,11 @@ pub struct Foo; /// ``` #[cfg(not(test))] pub struct Foo; + +/// this doctest will be tested, but will not appear in documentation: +/// +/// ``` +/// assert!(true) +/// ``` +#[cfg(doctest)] +pub struct Bar; diff --git a/src/test/rustdoc-ui/cfg-test.stdout b/src/test/rustdoc-ui/cfg-test.stdout index 67873870e89..de7e6097fb7 100644 --- a/src/test/rustdoc-ui/cfg-test.stdout +++ b/src/test/rustdoc-ui/cfg-test.stdout @@ -1,6 +1,7 @@ -running 1 test -test $DIR/cfg-test.rs - Foo (line 18) ... ok +running 2 tests +test $DIR/cfg-test.rs - Foo (line 20) ... ok +test $DIR/cfg-test.rs - Bar (line 28) ... ok -test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out +test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out |
