Skip to content

Commit

Permalink
Fix tests after revert of rustdoc cfg(test) feature
Browse files Browse the repository at this point in the history
  • Loading branch information
ollie27 committed Jun 8, 2019
1 parent 6cc42ce commit 6c747e0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/test/rustdoc-ui/cfg-test.rs
Expand Up @@ -2,18 +2,21 @@
// compile-flags:--test
// normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR"

// Crates like core have doctests gated on `cfg(not(test))` so we need to make
// sure `cfg(test)` is not active when running `rustdoc --test`.

/// this doctest will be ignored:
///
/// ```
/// assert!(false);
/// ```
#[cfg(not(test))]
#[cfg(test)]
pub struct Foo;

/// this doctest will be tested:
///
/// ```
/// assert!(true);
/// ```
#[cfg(test)]
#[cfg(not(test))]
pub struct Foo;
2 changes: 1 addition & 1 deletion src/test/rustdoc-ui/cfg-test.stdout
@@ -1,6 +1,6 @@

running 1 test
test $DIR/cfg-test.rs - Foo (line 15) ... ok
test $DIR/cfg-test.rs - Foo (line 18) ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

0 comments on commit 6c747e0

Please sign in to comment.