File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change 2
2
// compile-flags:--test
3
3
// normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR"
4
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
+
5
8
/// this doctest will be ignored:
6
9
///
7
10
/// ```
8
11
/// assert!(false);
9
12
/// ```
10
- #[ cfg( not ( test) ) ]
13
+ #[ cfg( test) ]
11
14
pub struct Foo ;
12
15
13
16
/// this doctest will be tested:
14
17
///
15
18
/// ```
16
19
/// assert!(true);
17
20
/// ```
18
- #[ cfg( test) ]
21
+ #[ cfg( not ( test) ) ]
19
22
pub struct Foo ;
Original file line number Diff line number Diff line change 1
1
2
2
running 1 test
3
- test $DIR/cfg-test.rs - Foo (line 15 ) ... ok
3
+ test $DIR/cfg-test.rs - Foo (line 18 ) ... ok
4
4
5
5
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
6
6
You can’t perform that action at this time.
0 commit comments