Don't run index preprocessor on `mdbook test`

This commit is contained in:
Matt Ickstadt 2018-07-25 12:17:17 -05:00
parent e5563182fc
commit 0e1787c617
4 changed files with 6 additions and 5 deletions

View File

@ -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 {

View File

@ -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")?;

View File

@ -1,6 +1,6 @@
# Summary
[dummy_book](README.md)
[Dummy Book](README.md)
[Introduction](intro.md)
- [First Chapter](first/index.md)

View File

@ -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());
}