forked from lettre/lettre
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(lettre): Replace skeptic by some custom rustdoc invocations
Unfortunately skeptic pulls all its dependencies in projects using lettre (see budziq/rust-skeptic#60).
- Loading branch information
Showing
3 changed files
with
63 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,6 @@ license = "MIT" | |
authors = ["Alexis Mousset <[email protected]>"] | ||
categories = ["email"] | ||
keywords = ["email", "smtp", "mailer"] | ||
build = "build.rs" | ||
|
||
[badges] | ||
travis-ci = { repository = "lettre/lettre" } | ||
|
@@ -30,10 +29,7 @@ serde_derive = { version = "^1.0", optional = true } | |
|
||
[dev-dependencies] | ||
env_logger = "^0.5" | ||
skeptic = "^0.13" | ||
|
||
[build-dependencies] | ||
skeptic = "^0.13" | ||
glob = "0.2" | ||
|
||
[features] | ||
default = ["file-transport", "crammd5-auth", "smtp-transport", "sendmail-transport"] | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,62 @@ | ||
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 test_readme() { | ||
let readme = Path::new(file!()) | ||
.parent() | ||
.unwrap() | ||
.parent() | ||
.unwrap() | ||
.parent() | ||
.unwrap() | ||
.join("README.md"); | ||
|
||
skeptic_test(&readme); | ||
} | ||
|
||
#[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/sending-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(), | ||
"Failed to run rustdoc tests on README.md!" | ||
); | ||
} |