2019-03-16 10:31:55 +00:00
|
|
|
#[cfg(feature = "test-doc")]
|
|
|
|
use {
|
|
|
|
docmatic,
|
|
|
|
std::default::Default,
|
|
|
|
std::path::{Path, PathBuf},
|
|
|
|
};
|
2018-04-21 23:45:57 +00:00
|
|
|
|
2019-03-16 10:31:55 +00:00
|
|
|
#[cfg(feature = "test-doc")]
|
2018-04-25 19:55:10 +00:00
|
|
|
fn assert_file<P: AsRef<Path>>(path: P) {
|
|
|
|
let mut doc = docmatic::Assert::default();
|
|
|
|
if cfg!(windows) {
|
2018-06-15 19:21:12 +00:00
|
|
|
doc.library_path(
|
|
|
|
option_env!("PYTHON")
|
|
|
|
.map(|py| PathBuf::from(py).join("libs"))
|
|
|
|
.unwrap(),
|
|
|
|
);
|
2018-04-25 19:55:10 +00:00
|
|
|
}
|
|
|
|
doc.test_file(path.as_ref())
|
2018-04-21 23:45:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
2019-02-14 09:41:52 +00:00
|
|
|
#[cfg(feature = "test-doc")]
|
2018-04-21 23:45:57 +00:00
|
|
|
fn test_guide() {
|
2018-04-25 12:45:54 +00:00
|
|
|
let guide_path = PathBuf::from("guide").join("src");
|
2018-04-21 23:45:57 +00:00
|
|
|
for entry in guide_path.read_dir().unwrap() {
|
2018-04-25 19:55:10 +00:00
|
|
|
assert_file(entry.unwrap().path())
|
2018-04-21 23:45:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
2019-02-14 09:41:52 +00:00
|
|
|
#[cfg(feature = "test-doc")]
|
2018-04-21 23:45:57 +00:00
|
|
|
fn test_readme() {
|
2018-04-25 19:55:10 +00:00
|
|
|
assert_file("README.md")
|
2018-04-21 23:45:57 +00:00
|
|
|
}
|