Migrate mdbook_runs_renderers to BookTest
This commit is contained in:
parent
cb2a63ea0a
commit
15c6f3f318
2 changed files with 8 additions and 11 deletions
|
|
@ -13,6 +13,7 @@ mod playground;
|
||||||
mod preprocessor;
|
mod preprocessor;
|
||||||
mod print;
|
mod print;
|
||||||
mod redirects;
|
mod redirects;
|
||||||
|
mod renderer;
|
||||||
|
|
||||||
mod prelude {
|
mod prelude {
|
||||||
pub use crate::book_test::BookTest;
|
pub use crate::book_test::BookTest;
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,8 @@
|
||||||
mod dummy_book;
|
//! Tests for custom renderers.
|
||||||
|
|
||||||
use crate::dummy_book::DummyBook;
|
use crate::prelude::*;
|
||||||
use mdbook::config::Config;
|
use mdbook::errors::Result;
|
||||||
use mdbook::errors::*;
|
|
||||||
use mdbook::renderer::{RenderContext, Renderer};
|
use mdbook::renderer::{RenderContext, Renderer};
|
||||||
use mdbook::MDBook;
|
|
||||||
use std::sync::{Arc, Mutex};
|
use std::sync::{Arc, Mutex};
|
||||||
|
|
||||||
struct Spy(Arc<Mutex<Inner>>);
|
struct Spy(Arc<Mutex<Inner>>);
|
||||||
|
|
@ -26,14 +24,12 @@ impl Renderer for Spy {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Test that renderer gets run.
|
||||||
#[test]
|
#[test]
|
||||||
fn mdbook_runs_renderers() {
|
fn runs_renderers() {
|
||||||
|
let test = BookTest::init(|_| {});
|
||||||
let spy: Arc<Mutex<Inner>> = Default::default();
|
let spy: Arc<Mutex<Inner>> = Default::default();
|
||||||
|
let mut book = test.load_book();
|
||||||
let temp = DummyBook::new().build().unwrap();
|
|
||||||
let cfg = Config::default();
|
|
||||||
|
|
||||||
let mut book = MDBook::load_with_config(temp.path(), cfg).unwrap();
|
|
||||||
book.with_renderer(Spy(Arc::clone(&spy)));
|
book.with_renderer(Spy(Arc::clone(&spy)));
|
||||||
book.build().unwrap();
|
book.build().unwrap();
|
||||||
|
|
||||||
Loading…
Add table
Reference in a new issue