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 22// compile-flags:--test
33// normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR"
44
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+
58/// this doctest will be ignored:
69///
710/// ```
811/// assert!(false);
912/// ```
10- #[ cfg( not ( test) ) ]
13+ #[ cfg( test) ]
1114pub struct Foo ;
1215
1316/// this doctest will be tested:
1417///
1518/// ```
1619/// assert!(true);
1720/// ```
18- #[ cfg( test) ]
21+ #[ cfg( not ( test) ) ]
1922pub struct Foo ;
Original file line number Diff line number Diff line change 11
22running 1 test
3- test $DIR/cfg-test.rs - Foo (line 15 ) ... ok
3+ test $DIR/cfg-test.rs - Foo (line 18 ) ... ok
44
55test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
66
You can’t perform that action at this time.
0 commit comments