2019-07-02 16:30:28 -05:00
|
|
|
// build-pass (FIXME(62277): could be check-pass?)
|
2019-04-24 15:26:42 -05:00
|
|
|
// compile-flags:--test
|
|
|
|
// normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR"
|
|
|
|
|
2019-05-25 18:11:30 -05:00
|
|
|
// 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`.
|
|
|
|
|
2019-06-28 10:31:27 -05:00
|
|
|
#![feature(cfg_doctest)]
|
|
|
|
|
2019-04-24 15:26:42 -05:00
|
|
|
/// this doctest will be ignored:
|
|
|
|
///
|
|
|
|
/// ```
|
|
|
|
/// assert!(false);
|
|
|
|
/// ```
|
2019-05-25 18:11:30 -05:00
|
|
|
#[cfg(test)]
|
2019-04-24 15:26:42 -05:00
|
|
|
pub struct Foo;
|
|
|
|
|
|
|
|
/// this doctest will be tested:
|
|
|
|
///
|
|
|
|
/// ```
|
|
|
|
/// assert!(true);
|
|
|
|
/// ```
|
2019-05-25 18:11:30 -05:00
|
|
|
#[cfg(not(test))]
|
2019-04-24 15:26:42 -05:00
|
|
|
pub struct Foo;
|
2019-06-28 10:31:27 -05:00
|
|
|
|
|
|
|
/// this doctest will be tested, but will not appear in documentation:
|
|
|
|
///
|
|
|
|
/// ```
|
|
|
|
/// assert!(true)
|
|
|
|
/// ```
|
|
|
|
#[cfg(doctest)]
|
|
|
|
pub struct Bar;
|