Skip to content

rustdoc: unmarked code fences are doctests too #20183

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

Merged
merged 1 commit into from
Dec 26, 2014
Merged

Conversation

japaric
Copy link
Member

@japaric japaric commented Dec 24, 2014

#20075 introduced a bug where unmarked code fences weren't considered as doctests. This PR fixes the logic.


This passed check-stage1-rustdoc, and I manually checked that:

//! ```
//! println!("Hello")
//! ```
//!
//! ``` rust
//! println!("Hello")
//! ```
//!
//! ``` sh
//! println!("Hello")
//! ```
//!
//! ``` ignore
//! println!("Hello")
//! ```

Generated:

running 3 tests
test _2 ... ignored
test _0 ... ok
test _1 ... ok

I'd love to add that as a test, but I have no idea how to do that with our testing infrastructure. If anyone knows how, do let me know!

r? @alexcrichton
@seanmonstar feedback?

t("{.sh .should_fail}", true,false,false,true,false);
t("{.example .rust}", false,false,false,true,false);
t("{.test_harness .rust}", false,false,false,true,true);
// marker | should_fail | no_run | ignore | rust | test_harness
Copy link
Contributor

Choose a reason for hiding this comment

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

\o/

Copy link
Contributor

Choose a reason for hiding this comment

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

I had started a macro t! where you would do t!("sh", rust == false) and t!("", rust == true, no_run == false) or whatever. But the table at least makes things easier to see.

geomaster added a commit to geomaster/cargo that referenced this pull request Dec 24, 2014
Two tests (test_with_deep_lib_dep and lib_with_standard_name) fail due
to a bug in rustdoc (see rust-lang/rust#20183) so temporarily changing
these so they pass. Be sure to change it back when the fix lands in the
current rust nightly
@aidanhs
Copy link
Member

aidanhs commented Dec 25, 2014

So this is why my doctests have gone silent. Eagerly awaiting bors...

bors added a commit that referenced this pull request Dec 26, 2014
#20075 introduced a bug where unmarked code fences weren't considered as doctests. This PR fixes the logic.

---

This passed `check-stage1-rustdoc`, and I manually checked that:

``` rust
//! ```
//! println!("Hello")
//! ```
//!
//! ``` rust
//! println!("Hello")
//! ```
//!
//! ``` sh
//! println!("Hello")
//! ```
//!
//! ``` ignore
//! println!("Hello")
//! ```
```

Generated:

``` rust
running 3 tests
test _2 ... ignored
test _0 ... ok
test _1 ... ok
```

I'd love to add that as a test, but I have no idea how to do that with our testing infrastructure. If anyone knows how, do let me know!

r? @alexcrichton 
@seanmonstar feedback?
@bors bors merged commit 86d8579 into rust-lang:master Dec 26, 2014
@japaric japaric deleted the doctests branch January 4, 2015 13:06
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.

5 participants