Add a test with a custom preprocessor
This test illustrates that the test function is not working correctly when there is a custom preprocessor.
This commit is contained in:
parent
6457b381d8
commit
2bcae6b0a9
1 changed files with 14 additions and 0 deletions
|
|
@ -44,6 +44,20 @@ fn runs_preprocessors() {
|
||||||
assert_eq!(inner.rendered_with, ["html"]);
|
assert_eq!(inner.rendered_with, ["html"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Run tests with a custom preprocessor.
|
||||||
|
#[test]
|
||||||
|
fn test_with_custom_preprocessor() {
|
||||||
|
let test = BookTest::init(|_| {});
|
||||||
|
let spy: Arc<Mutex<Inner>> = Default::default();
|
||||||
|
let mut book = test.load_book();
|
||||||
|
book.with_preprocessor(Spy(Arc::clone(&spy)));
|
||||||
|
book.test(vec![]).unwrap();
|
||||||
|
|
||||||
|
let inner = spy.lock().unwrap();
|
||||||
|
assert_eq!(inner.run_count, 0);
|
||||||
|
assert_eq!(inner.rendered_with, Vec::<String>::new());
|
||||||
|
}
|
||||||
|
|
||||||
// No-op preprocessor works.
|
// No-op preprocessor works.
|
||||||
#[test]
|
#[test]
|
||||||
fn nop_preprocessor() {
|
fn nop_preprocessor() {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue