test(lettre_email): Replace skeptic by some custom rustdoc invocations
This commit is contained in:
@@ -10,17 +10,13 @@ license = "MIT"
|
||||
authors = ["Alexis Mousset <contact@amousset.me>"]
|
||||
categories = ["email"]
|
||||
keywords = ["email", "mailer"]
|
||||
build = "build.rs"
|
||||
|
||||
[badges]
|
||||
travis-ci = { repository = "lettre/lettre_email" }
|
||||
|
||||
[dev-dependencies]
|
||||
lettre = { version = "^0.8", path = "../lettre", features = ["smtp-transport"] }
|
||||
skeptic = "^0.13"
|
||||
|
||||
[build-dependencies]
|
||||
skeptic = "^0.13"
|
||||
glob = "0.2"
|
||||
|
||||
[dependencies]
|
||||
email = "^0.0"
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
extern crate skeptic;
|
||||
|
||||
use skeptic::*;
|
||||
|
||||
fn main() {
|
||||
let mut mdbook_files = markdown_files_of_directory("../website/content/creating-messages/");
|
||||
// Also add "README.md" to the list of files.
|
||||
mdbook_files.push("README.md".into());
|
||||
|
||||
generate_doc_tests(&mdbook_files);
|
||||
}
|
||||
@@ -1 +1,48 @@
|
||||
include!(concat!(env!("OUT_DIR"), "/skeptic-tests.rs"));
|
||||
extern crate glob;
|
||||
|
||||
use self::glob::glob;
|
||||
use std::env::consts::EXE_EXTENSION;
|
||||
use std::env;
|
||||
use std::path::Path;
|
||||
use std::process::Command;
|
||||
|
||||
#[test]
|
||||
fn book_test() {
|
||||
let mut book_path = env::current_dir().unwrap();
|
||||
book_path.push(
|
||||
Path::new(file!())
|
||||
.parent()
|
||||
.unwrap()
|
||||
.parent()
|
||||
.unwrap()
|
||||
.parent()
|
||||
.unwrap()
|
||||
.join("../website/content/creating-messages"),
|
||||
); // For some reasons, calling .parent() once more gives us None...
|
||||
|
||||
for md in glob(&format!("{}/*.md", book_path.to_str().unwrap())).unwrap() {
|
||||
skeptic_test(&md.unwrap());
|
||||
}
|
||||
}
|
||||
|
||||
fn skeptic_test(path: &Path) {
|
||||
let rustdoc = Path::new("rustdoc").with_extension(EXE_EXTENSION);
|
||||
let exe = env::current_exe().unwrap();
|
||||
let depdir = exe.parent().unwrap();
|
||||
|
||||
let mut cmd = Command::new(rustdoc);
|
||||
cmd.args(&["--verbose", "--test"])
|
||||
.arg("-L")
|
||||
.arg(&depdir)
|
||||
.arg(path);
|
||||
|
||||
let result = cmd.spawn()
|
||||
.expect("Failed to spawn process")
|
||||
.wait()
|
||||
.expect("Failed to run process");
|
||||
|
||||
assert!(
|
||||
result.success(),
|
||||
format!("Failed to run rustdoc tests on {:?}!", path)
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user