Skip to content

doc test marked with ignore gets compiled and executed #32556

Closed
@japaric

Description

@japaric

STR

$ cargo new foo
$ cd foo
$ cat src/lib.rs
/// TEXT GOES HERE
/// ``` ignore,
/// #extern crate foo;
/// #
/// #fn main() {
///     assert!(false);
/// #}
///
fn foo() {}

$ cargo test
     Running target/debug/foo-0201ccfee7015899

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured

   Doc-tests foo

running 1 test
test foo_0 ... FAILED

failures:

---- foo_0 stdout ----
        thread 'foo_0' panicked at 'test executable failed:

thread '<main>' panicked at 'assertion failed: false', <anon>:2
note: Run with `RUST_BACKTRACE=1` for a backtrace.
', ../src/librustdoc/test.rs:311
note: Run with `RUST_BACKTRACE=1` for a backtrace.


failures:
    foo_0

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured

error: test failed

But, if we add an empty line between the start of the doc test fence and TEXT GOES HERE, the doc test is ignored.

 /// TEXT GOES HERE
+///
 /// ``` ignore,
 /// #extern crate foo;
 /// #
$ cargo test
     Running target/debug/foo-0201ccfee7015899

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured

   Doc-tests foo

running 1 test
test foo_0 ... ignored

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

Meta

$ rustc -V
rustc 1.9.0-nightly (d5a91e695 2016-03-26)
$ cargo -V
cargo 0.10.0-nightly (25e1301 2016-03-25)

cc @azerupi

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.T-dev-toolsRelevant to the dev-tools subteam, which will review and decide on the PR/issue.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions