Skip to content

Commit

Permalink
Fix test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
notriddle committed Jun 8, 2024
1 parent 806d2a9 commit 463ec1a
Show file tree
Hide file tree
Showing 7 changed files with 210 additions and 14 deletions.
180 changes: 180 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 19 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,20 @@ description = "Creates a book from markdown files"
rust-version = "1.74"
build = "build.rs"

[build-dependencies]
syntect = { version = "5.1.0" }
[build-dependencies.syntect]
version = "5.1.0"
default-features = false
features = [
# regex-onig, the default, isn't portable enough
"regex-fancy",
"parsing",
"default-syntaxes",
"default-themes",
"html",
"yaml-load",
"dump-load",
"dump-create",
]

[dependencies]
anyhow = "1.0.71"
Expand Down Expand Up @@ -67,7 +79,7 @@ walkdir = "2.3.3"

[features]
default = ["watch", "serve", "search", "gen-syntax-cache"]
watch = ["dep:notify", "dep:notify-debouncer-mini", "dep:ignore"]
watch = ["dep:notify", "dep:notify-debouncer-mini", "dep:ignore", "dep:pathdiff", "dep:walkdir"]
serve = ["dep:futures-util", "dep:tokio", "dep:warp"]
search = ["dep:elasticlunr-rs", "dep:ammonia"]
gen-syntax-cache = ["syntect/dump-create"]
Expand All @@ -79,3 +91,7 @@ name = "mdbook"
[[example]]
name = "nop-preprocessor"
test = true

[profile.dev]
opt-level = 1

2 changes: 1 addition & 1 deletion src/cmd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

pub mod build;
pub mod clean;
pub mod command_prelude;
#[cfg(feature = "gen-syntax-cache")]
pub mod gen_syntax_cache;
pub mod command_prelude;
pub mod init;
#[cfg(feature = "serve")]
pub mod serve;
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/html_handlebars/hbs_renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ impl Renderer for HtmlHandlebars {
None => ctx.root.join("theme"),
};

let theme = theme::Theme::new(theme_dir);
let theme = theme::Theme::new(theme_dir.clone());

debug!("Collect syntaxes into a syntax set");
self.build_syntaxset(&theme, &theme_dir);
Expand Down
2 changes: 1 addition & 1 deletion src/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ impl<'a> SyntaxHighlighter<'a> {
)))
}
}
Event::End(Tag::CodeBlock(CodeBlockKind::Fenced(_))) => {
Event::End(TagEnd::CodeBlock) => {
self.highlight = false;
self.is_rust = false;
self.syntax = None;
Expand Down
2 changes: 1 addition & 1 deletion tests/rendered_output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,7 @@ mod search {
// Setting this to `true` may cause issues with `cargo watch`,
// since it may not finish writing the fixture before the tests
// are run again.
const GENERATE_FIXTURE: bool = true;
const GENERATE_FIXTURE: bool = false;

fn get_fixture() -> serde_json::Value {
if GENERATE_FIXTURE {
Expand Down
Loading

0 comments on commit 463ec1a

Please sign in to comment.