Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

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

26 changes: 3 additions & 23 deletions crates/biome_markdown_parser/tests/fuzz_differential.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,14 @@
//!
//! Run with: cargo test -p biome_markdown_parser --test fuzz_differential -- --ignored --nocapture

mod test_utils;

use biome_markdown_parser::{document_to_html, parse_markdown};
use biome_markdown_syntax::MdDocument;
use biome_rowan::AstNode;
use std::fs;
use std::path::{Path, PathBuf};

/// Normalize HTML for comparison, preserving whitespace inside `<pre>` blocks.
/// Matches the normalization in `xtask/coverage/src/markdown/commonmark.rs`.
fn normalize_html(html: &str) -> String {
let mut result = Vec::new();
let mut in_pre = false;

for line in html.lines() {
if line.contains("<pre") {
in_pre = true;
}
if in_pre {
result.push(line.to_string());
} else {
result.push(line.trim_end().to_string());
}
if line.contains("</pre>") {
in_pre = false;
}
}

result.join("\n").trim().to_string() + "\n"
}
use test_utils::normalize_html;

/// FNV-1a 64-bit hash — deterministic across Rust toolchain versions.
fn content_hash(s: &str) -> String {
Expand Down
25 changes: 3 additions & 22 deletions crates/biome_markdown_parser/tests/spec_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,28 +193,9 @@ pub fn run(test_case: &str, _snapshot_name: &str, test_directory: &str, outcome_
});
}

/// Normalize HTML for comparison, preserving whitespace inside `<pre>` blocks.
/// Matches the normalization in `xtask/coverage/src/markdown/commonmark.rs`.
fn normalize_html(html: &str) -> String {
let mut result = Vec::new();
let mut in_pre = false;

for line in html.lines() {
if line.contains("<pre") {
in_pre = true;
}
if in_pre {
result.push(line.to_string());
} else {
result.push(line.trim_end().to_string());
}
if line.contains("</pre>") {
in_pre = false;
}
}

result.join("\n").trim().to_string() + "\n"
}
#[path = "test_utils.rs"]
mod test_utils;
use test_utils::normalize_html;

#[test]
pub fn quick_test() {
Expand Down
22 changes: 22 additions & 0 deletions crates/biome_markdown_parser/tests/test_utils.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/// Normalize HTML for comparison, preserving whitespace inside `<pre>` blocks.
/// Matches the normalization in `xtask/coverage/src/markdown/commonmark.rs`.
pub fn normalize_html(html: &str) -> String {
let mut result = Vec::new();
let mut in_pre = false;

for line in html.lines() {
if line.contains("<pre") {
in_pre = true;
}
if in_pre {
result.push(line.to_string());
} else {
result.push(line.trim_end().to_string());
}
if line.contains("</pre>") {
in_pre = false;
}
}

result.join("\n").trim().to_string() + "\n"
}
2 changes: 1 addition & 1 deletion deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ all-features = true
multiple-versions = "allow"

[advisories]
unmaintained = 'workspace'
unmaintained = "workspace"
Loading