mirror of
https://github.com/rust-lang-nursery/rust-cookbook
synced 2025-02-16 12:18:27 +00:00
Merge pull request #8 from Charlesetc/test-all-files
build.rs runs all the tests with new skeptic library
This commit is contained in:
commit
88aa7bf477
2 changed files with 9 additions and 15 deletions
|
@ -11,7 +11,7 @@ error-chain = "0.8.0"
|
|||
json = "0.11.5"
|
||||
|
||||
[build-dependencies]
|
||||
skeptic = "0.6"
|
||||
skeptic = "0.7"
|
||||
|
||||
[dev-dependencies]
|
||||
skeptic = "0.6"
|
||||
skeptic = "0.7"
|
||||
|
|
20
build.rs
20
build.rs
|
@ -3,18 +3,12 @@ extern crate skeptic;
|
|||
use std::fs;
|
||||
|
||||
fn main() {
|
||||
let paths = fs::read_dir("./pages/").unwrap();
|
||||
let mut vec = Vec::new();
|
||||
let paths = fs::read_dir("./pages/").unwrap()
|
||||
// convert paths to Strings
|
||||
.map(|p| p.unwrap().path().to_str().unwrap().to_string())
|
||||
// only compile markdown files
|
||||
.filter(|p| p.ends_with(".md"))
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
// Convert paths to strings and add to vec
|
||||
for path in paths {
|
||||
let p = path.unwrap().path();
|
||||
let s = p.to_str().unwrap();
|
||||
if s.contains(".md") {
|
||||
vec.push(s.to_string());
|
||||
}
|
||||
}
|
||||
// Convert Vec<String> to Vec<str>
|
||||
let vec: Vec<_> = vec.iter().map(|s|&s[..]).collect();
|
||||
skeptic::generate_doc_tests(&vec);
|
||||
skeptic::generate_doc_tests(&paths[..]);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue