From 824e2a7681e0d6e0e778b27b494d8fe3db3a3443 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Mon, 11 Aug 2025 19:21:03 -0700 Subject: [PATCH] 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. --- tests/testsuite/book_test.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/testsuite/book_test.rs b/tests/testsuite/book_test.rs index e40ca63c..082bf6d2 100644 --- a/tests/testsuite/book_test.rs +++ b/tests/testsuite/book_test.rs @@ -230,6 +230,12 @@ impl BookTest { }; f(&mut cmd); cmd.run(); + // Ensure that `built` gets set if a build command is used so that all + // the `check` methods do not overwrite the contents of what was just + // built. + if cmd.args.first().map(String::as_str) == Some("build") { + self.built = true + } self }