Skip to content

Commit 824e2a7

Browse files
committed
Don't rebuild books in tests
This fixes an issue where the `check` methods would inadvertently rebuild the books if the `mdbook build` command is run. Normally this isn't too much of an issue unless the `build` command is run with options that affect the output.
1 parent 4a2d3a7 commit 824e2a7

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tests/testsuite/book_test.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,12 @@ impl BookTest {
230230
};
231231
f(&mut cmd);
232232
cmd.run();
233+
// Ensure that `built` gets set if a build command is used so that all
234+
// the `check` methods do not overwrite the contents of what was just
235+
// built.
236+
if cmd.args.first().map(String::as_str) == Some("build") {
237+
self.built = true
238+
}
233239
self
234240
}
235241

0 commit comments

Comments
 (0)