Skip to content

Commit

Permalink
Merge #657
Browse files Browse the repository at this point in the history
657: Automatically check if README.md examples are working when running "cargo test" r=cuviper a=GuillaumeGomez

Since rustdoc nightly now provides "cfg(test)" when running on test mode, we can now use this macro on test mode only to check if README.md examples are working as expected.

Co-authored-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
Co-authored-by: Josh Stone <cuviper@gmail.com>
  • Loading branch information
3 people committed May 1, 2019
2 parents 047ea91 + 4547a27 commit 6c9e02e
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@ rand = "0.6"
rand_xorshift = "0.1"
serde = "1"
serde_derive = "1"
doc-comment = "0.3"
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,14 @@ command to get a visualization of an nbody simulation. To see the
effect of using Rayon, press `s` to run sequentially and `p` to run in
parallel.

```
```text
> cd rayon-demo
> cargo run --release -- nbody visualize
```

For more information on demos, try:

```
```text
> cd rayon-demo
> cargo run --release -- --help
```
Expand Down
2 changes: 1 addition & 1 deletion rayon-core/src/compile_fail/scope_join_bad.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! ```compile_fail,E0597
/*! ```compile_fail,E0373
fn bad_scope<F>(f: F)
where F: FnOnce(&i32) + Send,
Expand Down
2 changes: 1 addition & 1 deletion rayon-futures/src/compile_fail/future_escape.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! ```compile_fail,E0501,E0382,E0597
/*! ```compile_fail,E0382,E0501,E0503,E0716
extern crate futures;
extern crate rayon_core;
Expand Down
6 changes: 6 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ extern crate rayon_core;
extern crate rand;
#[cfg(test)]
extern crate rand_xorshift;
#[cfg(test)]
#[macro_use]
extern crate doc_comment;

#[cfg(test)]
doctest!("../README.md");

#[macro_use]
mod delegate;
Expand Down

0 comments on commit 6c9e02e

Please sign in to comment.