Skip to content

Commit

Permalink
Don't run index preprocessor on mdbook test
Browse files Browse the repository at this point in the history
  • Loading branch information
mattico committed Jul 25, 2018
1 parent e556318 commit 0e1787c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/book/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,12 +213,13 @@ impl MDBook {
.flat_map(|x| vec![x.0, x.1])
.collect();

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

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

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

for item in self.iter() {
if let BookItem::Chapter(ref ch) = *item {
Expand Down
2 changes: 1 addition & 1 deletion tests/dummy_book/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ impl DummyBook {
/// Write a book to a temporary directory using the provided settings.
pub fn build(&self) -> Result<TempDir> {
let temp = TempFileBuilder::new()
.prefix("dummy_book")
.prefix("dummy_book-")
.tempdir()
.chain_err(|| "Unable to create temp directory")?;

Expand Down
2 changes: 1 addition & 1 deletion tests/dummy_book/src/SUMMARY.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Summary

[dummy_book](README.md)
[Dummy Book](README.md)
[Introduction](intro.md)

- [First Chapter](first/index.md)
Expand Down
2 changes: 1 addition & 1 deletion tests/testing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ fn mdbook_can_correctly_test_a_passing_book() {
#[test]
fn mdbook_detects_book_with_failing_tests() {
let temp = DummyBook::new().with_passing_test(false).build().unwrap();
let mut md: MDBook = MDBook::load(temp.path()).unwrap();
let mut md = MDBook::load(temp.path()).unwrap();

assert!(md.test(vec![]).is_err());
}
Expand Down

0 comments on commit 0e1787c

Please sign in to comment.