mirror of
https://github.com/rust-lang/mdBook
synced 2024-12-14 14:52:37 +00:00
cef62ec42e
Move non-test test module files into their own directories to prevent cargo from running them as tests. Then suppress the left-over warnings. Move *dummy book* code and data into a shared folder, and leave the rest of helper utilities (one function) in the original module.
28 lines
563 B
Rust
28 lines
563 B
Rust
extern crate mdbook;
|
|
extern crate tempdir;
|
|
|
|
mod dummy;
|
|
|
|
use dummy::DummyBook;
|
|
use mdbook::MDBook;
|
|
|
|
|
|
#[test]
|
|
fn mdbook_can_correctly_test_a_passing_book() {
|
|
let temp = DummyBook::default()
|
|
.with_passing_test(true)
|
|
.build();
|
|
let mut md = MDBook::new(temp.path());
|
|
|
|
assert!(md.test(vec![]).is_ok());
|
|
}
|
|
|
|
#[test]
|
|
fn mdbook_detects_book_with_failing_tests() {
|
|
let temp = DummyBook::default()
|
|
.with_passing_test(false)
|
|
.build();
|
|
let mut md: MDBook = MDBook::new(temp.path());
|
|
|
|
assert!(md.test(vec![]).is_err());
|
|
}
|