Skip to content

Commit e519fd4

Browse files
Automatically check if README.md examples are working when running "cargo test"
1 parent 88994b2 commit e519fd4

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ optional = true
2121
[features]
2222
spin_no_std = ["spin"]
2323

24+
[dev-dependencies]
25+
doc-comment = "0.3.1"
26+
2427
[badges]
2528
appveyor = { repository = "rust-lang-nursery/lazy-static.rs" }
2629
travis-ci = { repository = "rust-lang-nursery/lazy-static.rs" }

src/lib.rs

+7
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,13 @@ This crate provides one cargo feature:
104104
#[doc(hidden)]
105105
pub mod lazy;
106106

107+
#[cfg(test)]
108+
#[macro_use]
109+
extern crate doc_comment;
110+
111+
#[cfg(test)]
112+
doctest!("../README.md");
113+
107114
#[cfg(feature = "spin_no_std")]
108115
#[path="core_lazy.rs"]
109116
#[doc(hidden)]

0 commit comments

Comments
 (0)