-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Run "rustdoc --test README.md" directly instead of using skeptic.
Should fix #16. See also budziq/rust-skeptic#60.
- Loading branch information
Showing
4 changed files
with
43 additions
and
12 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
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
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,37 @@ | ||
include!(concat!(env!("OUT_DIR"), "/skeptic-tests.rs")); | ||
extern crate glob; | ||
extern crate which; | ||
|
||
#[test] | ||
fn readme_test() { | ||
let rustdoc = which::which("rustdoc").unwrap(); | ||
|
||
let readme = std::path::Path::new(file!()).canonicalize().unwrap(); | ||
let readme = readme.parent().unwrap().parent().unwrap().join("README.md"); | ||
let readme = readme.to_str().unwrap(); | ||
|
||
let deps = std::path::Path::new(&std::env::current_exe().unwrap()) | ||
.canonicalize() | ||
.unwrap(); | ||
let deps = deps.parent().unwrap(); | ||
|
||
let liblog = glob::glob(deps.join("liblog-*.rlib").to_str().unwrap()) | ||
.unwrap() | ||
.next() | ||
.unwrap() | ||
.unwrap(); | ||
let liblog = liblog.to_str().unwrap(); | ||
|
||
let mut cmd = std::process::Command::new(rustdoc); | ||
cmd.arg("--verbose") | ||
.args(&["--library-path", deps.to_str().unwrap()]) | ||
.args(&["--extern", &format!("log={}", liblog)]) | ||
.arg("--test") | ||
.arg(&readme); | ||
|
||
let result = cmd.spawn() | ||
.expect("Failed to spawn rustdoc process") | ||
.wait() | ||
.expect("Failed to run rustdoc process"); | ||
|
||
assert!(result.success(), "Failed to run rustdoc tests on README.md"); | ||
} |