This commit is contained in:
2025-08-30 17:27:24 -05:00
parent b0205144be
commit 0aca4c36cb
2 changed files with 20 additions and 7 deletions
+1 -1
View File
@@ -10,4 +10,4 @@ rfd = "0.15.4"
thiserror = "2.0.16"
toml = "0.9.5"
markdown = "1.0.0"
serde = "1.0.219"
serde = { version = "1.0.219", features = ["derive"] }
+19 -6
View File
@@ -96,14 +96,27 @@ fn find_frontmatter(node: Node, source: PathBuf) -> Result<Option<Frontmatter>,
mod tests {
use super::*;
#[test]
fn test_rendering_markdown() {
fn render_index() -> RenderOutput {
match render("index.md".into(), "./testdata".into()) {
Err(e) => println!("{}", e),
Ok(ro) => {
println!("File: {}", ro.filename.to_str().unwrap());
println!("Contents:\n\n{}", ro.contents);
Ok(ro) => ro,
Err(e) => {
println!("{}", e);
panic!();
}
}
}
#[test]
fn test_rendering_markdown() {
let RenderOutput { contents, filename } = render_index();
assert_eq!(filename.to_str(), Some("index.html")); // Goes to the right filename
assert!(contents.starts_with("<!DOCTYPE html>")); // Uses the layout
assert!(contents.matches("Pest Toast").next().is_some()); // Replaces in the title
assert!(contents.matches("<code class=\"language-rust\">").next().is_some()); // Renders the code snippet
assert!(contents.matches("<table>").next().is_some()); // Renders the table
}
#[test]
fn test_no_layout() {
}
}