Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc test marked with ignore gets compiled and executed #32556

Closed
japaric opened this issue Mar 28, 2016 · 8 comments
Closed

doc test marked with ignore gets compiled and executed #32556

japaric opened this issue Mar 28, 2016 · 8 comments
Labels
C-bug Category: This is a bug. T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@japaric
Copy link
Member

japaric commented Mar 28, 2016

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

@steveklabnik
Copy link
Member

I believe this is a duplicate, but can't remember the original...

@steveklabnik steveklabnik added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Mar 28, 2016
@GuillaumeGomez
Copy link
Member

I'll take a look.

@GuillaumeGomez
Copy link
Member

The issue seems to be in the hoedown library. I'll take a deeper look later.

@pmarcelll
Copy link
Contributor

@steveklabnik you are right: #28712

@steveklabnik steveklabnik added T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue. and removed T-tools labels May 18, 2017
@Mark-Simulacrum Mark-Simulacrum added the C-bug Category: This is a bug. label Jul 24, 2017
@hadronized
Copy link

I just experienced the bug as well now. Is there a workaround?

@GuillaumeGomez
Copy link
Member

GuillaumeGomez commented Aug 8, 2017

Adding an empty line before the code block and hoping that the common-mark pull request gets merged some day.

@Phlosioneer
Copy link
Contributor

Triage: This is fixed. Probably because common-mark got merged.

Phlosioneer added a commit to Phlosioneer/rust that referenced this issue Mar 31, 2018
This will check for regression on issue rust-lang#32556
@steveklabnik
Copy link
Member

That's correct! nice catch, @Phlosioneer

kennytm added a commit to kennytm/rust that referenced this issue Apr 3, 2018
…n-test, r=GuillaumeGomez

Add test for rustdoc ignore test

This will check for regression on issue rust-lang#32556
kennytm added a commit to kennytm/rust that referenced this issue Apr 4, 2018
…n-test, r=GuillaumeGomez

Add test for rustdoc ignore test

This will check for regression on issue rust-lang#32556
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

7 participants