Merge pull request #8 from Charlesetc/test-all-files

build.rs runs all the tests with new skeptic library
This commit is contained in:
Trent Spice 2017-02-25 13:26:14 -05:00 committed by GitHub
commit 88aa7bf477
2 changed files with 9 additions and 15 deletions

View file

@ -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"

View file

@ -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[..]);
}