Skip to content

Commit 2bcae6b

Browse files
committed
Add a test with a custom preprocessor
This test illustrates that the test function is not working correctly when there is a custom preprocessor.
1 parent 6457b38 commit 2bcae6b

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/testsuite/preprocessor.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,20 @@ fn runs_preprocessors() {
4444
assert_eq!(inner.rendered_with, ["html"]);
4545
}
4646

47+
// Run tests with a custom preprocessor.
48+
#[test]
49+
fn test_with_custom_preprocessor() {
50+
let test = BookTest::init(|_| {});
51+
let spy: Arc<Mutex<Inner>> = Default::default();
52+
let mut book = test.load_book();
53+
book.with_preprocessor(Spy(Arc::clone(&spy)));
54+
book.test(vec![]).unwrap();
55+
56+
let inner = spy.lock().unwrap();
57+
assert_eq!(inner.run_count, 0);
58+
assert_eq!(inner.rendered_with, Vec::<String>::new());
59+
}
60+
4761
// No-op preprocessor works.
4862
#[test]
4963
fn nop_preprocessor() {

0 commit comments

Comments
 (0)