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

Fix #12939: reporting of ignored tests in rustdoc #13272

Merged
merged 1 commit into from
Apr 4, 2014
Merged

Fix #12939: reporting of ignored tests in rustdoc #13272

merged 1 commit into from
Apr 4, 2014

Conversation

ipetkov
Copy link
Contributor

@ipetkov ipetkov commented Apr 3, 2014

librustdoc: instead of skipping ignored tests, pass them to libtest
so it can report them as such. If a test is marked as notrust,
however, it will not show up in the final report.

Fix #12939

@@ -279,13 +279,12 @@ pub fn find_testable_code(doc: &str, tests: &mut ::test::Collector) {
s.contains("ignore") || s.contains("notrust"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This condition should change slightly I think. It should consider ignore as "print this during the test run, but don't run it" and notrust as "ignore this entirely for testing".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a really good point, hadn't thought about that!

@alexcrichton
Copy link
Member

I'm a little confused about the changes to libtest, could you provide a before/after of what you changed? For example, this is what I get today:

#[test] fn a() {}
#[ignore] #[test] fn b() {}
$ ./foo                     

running 2 tests
test b ... ignored
test a ... ok

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

librustdoc: instead of skipping ignored tests, pass them to libtest
so it can report them as such.  If a test is marked as `notrust`,
however, it will not show up in the final report.
@ipetkov
Copy link
Contributor Author

ipetkov commented Apr 4, 2014

Sorry I should have made this clearer: this change affects running documentation tests under rustdoc, e.g.

// foo.rs
#![crate_id="foo"]

//! This is a small crate

/**
```rust
assert!(true);
```

```ignore
assert!(!false);
```
*/
/// foo always returns 5
pub fn foo() -> int {
    5
}
$ rustdoc --test foo.rs 

running 1 test
test foo_0 ... ok

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

This is the result I get after building from master, when it should really output test result: 1 passed; 0 failed; 1 ignored; 0 measured for the last line.

I'm a little confused about the changes to libtest, could you provide a before/after of what you changed?

Looking over the diff again I just realized my misunderstanding of some code in libtest. I (wrongly) believed that libtest was also dropping tests marked as ignored, and tried to "improve" the code. The main problem for this issue is just rustdoc ignoring the tests. I'll remove my changes to libtest and update the PR branch.

@ipetkov
Copy link
Contributor Author

ipetkov commented Apr 4, 2014

Updated the PR branch, and re-rebased on master

bors added a commit that referenced this pull request Apr 4, 2014
…hton

librustdoc: instead of skipping ignored tests, pass them to libtest
so it can report them as such.  If a test is marked as `notrust`,
however, it will not show up in the final report.

Fix #12939
@bors bors closed this Apr 4, 2014
@bors bors merged commit a0a7693 into rust-lang:master Apr 4, 2014
@ipetkov ipetkov deleted the rustdoc-ignored-tests branch April 5, 2014 02:39
matthiaskrgr pushed a commit to matthiaskrgr/rust that referenced this pull request Oct 11, 2022
docs(guide): fix Analysis and AnalysisHost doc links
Jarcho pushed a commit to Jarcho/rust that referenced this pull request Aug 24, 2024
flip1995: 2 week vacation

r? `@ghost`
changelog: none
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

rustdoc treats ignored doc tests incorrectly
3 participants