]> git.lizzy.rs Git - rust.git/blob - src/test/rustdoc-ui/cfg-test.rs
Add regression test for #64319 back in.
[rust.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 /// this doctest will be ignored:
9 ///
10 /// ```
11 /// assert!(false);
12 /// ```
13 #[cfg(test)]
14 pub struct Foo;
15
16 /// this doctest will be tested:
17 ///
18 /// ```
19 /// assert!(true);
20 /// ```
21 #[cfg(not(test))]
22 pub struct Foo;
23
24 /// this doctest will be tested, but will not appear in documentation:
25 ///
26 /// ```
27 /// assert!(true)
28 /// ```
29 #[cfg(doctest)]
30 pub struct Bar;