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 print;
|
||||
mod redirects;
|
||||
mod renderer;
|
||||
|
||||
mod prelude {
|
||||
pub use crate::book_test::BookTest;
|
||||
|
|
|
|||
|
|
@ -1,10 +1,8 @@
|
|||
mod dummy_book;
|
||||
//! Tests for custom renderers.
|
||||
|
||||
use crate::dummy_book::DummyBook;
|
||||
use mdbook::config::Config;
|
||||
use mdbook::errors::*;
|
||||
use crate::prelude::*;
|
||||
use mdbook::errors::Result;
|
||||
use mdbook::renderer::{RenderContext, Renderer};
|
||||
use mdbook::MDBook;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
struct Spy(Arc<Mutex<Inner>>);
|
||||
|
|
@ -26,14 +24,12 @@ impl Renderer for Spy {
|
|||
}
|
||||
}
|
||||
|
||||
// Test that renderer gets run.
|
||||
#[test]
|
||||
fn mdbook_runs_renderers() {
|
||||
fn runs_renderers() {
|
||||
let test = BookTest::init(|_| {});
|
||||
let spy: Arc<Mutex<Inner>> = Default::default();
|
||||
|
||||
let temp = DummyBook::new().build().unwrap();
|
||||
let cfg = Config::default();
|
||||
|
||||
let mut book = MDBook::load_with_config(temp.path(), cfg).unwrap();
|
||||
let mut book = test.load_book();
|
||||
book.with_renderer(Spy(Arc::clone(&spy)));
|
||||
book.build().unwrap();
|
||||
|
||||
Loading…
Add table
Reference in a new issue