Skip to content

Commit 366fdeb

Browse files
Add new rustdoc-ui test to ensuire that rustdoc feature isn't passed down to doctests
1 parent 445e735 commit 366fdeb

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// build-pass
2+
// compile-flags:--test
3+
// normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR"
4+
5+
#![feature(doc_cfg)]
6+
7+
// Make sure `cfg(rustdoc)` is set when finding doctests but not inside the doctests.
8+
9+
/// ```
10+
/// #![feature(doc_cfg)]
11+
/// assert!(!cfg!(rustdoc));
12+
/// ```
13+
#[cfg(rustdoc)]
14+
pub struct Foo;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
running 1 test
3+
test $DIR/doc-test-rustdoc-feature.rs - Foo (line 9) ... ok
4+
5+
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
6+

0 commit comments

Comments
 (0)