Skip to content

Commit 0e1787c

Browse files
committed
Don't run index preprocessor on mdbook test
1 parent e556318 commit 0e1787c

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

src/book/mod.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,12 +213,13 @@ impl MDBook {
213213
.flat_map(|x| vec![x.0, x.1])
214214
.collect();
215215

216-
let temp_dir = TempFileBuilder::new().prefix("mdbook").tempdir()?;
216+
let temp_dir = TempFileBuilder::new().prefix("mdbook-").tempdir()?;
217217

218218
let preprocess_context = PreprocessorContext::new(self.root.clone(), self.config.clone());
219219

220220
LinkPreprocessor::new().run(&preprocess_context, &mut self.book)?;
221-
IndexPreprocessor::new().run(&preprocess_context, &mut self.book)?;
221+
// Index Preprocessor is disabled so that chapter paths continue to point to the
222+
// actual markdown files.
222223

223224
for item in self.iter() {
224225
if let BookItem::Chapter(ref ch) = *item {

tests/dummy_book/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ impl DummyBook {
4747
/// Write a book to a temporary directory using the provided settings.
4848
pub fn build(&self) -> Result<TempDir> {
4949
let temp = TempFileBuilder::new()
50-
.prefix("dummy_book")
50+
.prefix("dummy_book-")
5151
.tempdir()
5252
.chain_err(|| "Unable to create temp directory")?;
5353

tests/dummy_book/src/SUMMARY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Summary
22

3-
[dummy_book](README.md)
3+
[Dummy Book](README.md)
44
[Introduction](intro.md)
55

66
- [First Chapter](first/index.md)

tests/testing.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ fn mdbook_can_correctly_test_a_passing_book() {
2323
#[test]
2424
fn mdbook_detects_book_with_failing_tests() {
2525
let temp = DummyBook::new().with_passing_test(false).build().unwrap();
26-
let mut md: MDBook = MDBook::load(temp.path()).unwrap();
26+
let mut md = MDBook::load(temp.path()).unwrap();
2727

2828
assert!(md.test(vec![]).is_err());
2929
}

0 commit comments

Comments
 (0)