]> git.proxmox.com Git - rustc.git/blob - src/test/rustdoc-ui/cfg-test.rs
New upstream version 1.38.0+dfsg1
[rustc.git] / src / test / rustdoc-ui / cfg-test.rs
1 // build-pass (FIXME(62277): could be check-pass?)
2 // compile-flags:--test --test-args --test-threads=1
3 // normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR"
4
5 // Crates like core have doctests gated on `cfg(not(test))` so we need to make
6 // sure `cfg(test)` is not active when running `rustdoc --test`.
7
8 #![feature(cfg_doctest)]
9
10 /// this doctest will be ignored:
11 ///
12 /// ```
13 /// assert!(false);
14 /// ```
15 #[cfg(test)]
16 pub struct Foo;
17
18 /// this doctest will be tested:
19 ///
20 /// ```
21 /// assert!(true);
22 /// ```
23 #[cfg(not(test))]
24 pub struct Foo;
25
26 /// this doctest will be tested, but will not appear in documentation:
27 ///
28 /// ```
29 /// assert!(true)
30 /// ```
31 #[cfg(doctest)]
32 pub struct Bar;