pyo3/tests/test_doc.rs

35 lines
752 B
Rust
Raw Normal View History

#[cfg(feature = "test-doc")]
use {
docmatic,
std::default::Default,
std::path::{Path, PathBuf},
};
#[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) {
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())
}
#[test]
#[cfg(feature = "test-doc")]
fn test_guide() {
let guide_path = PathBuf::from("guide").join("src");
for entry in guide_path.read_dir().unwrap() {
2018-04-25 19:55:10 +00:00
assert_file(entry.unwrap().path())
}
}
#[test]
#[cfg(feature = "test-doc")]
fn test_readme() {
2018-04-25 19:55:10 +00:00
assert_file("README.md")
}