wip2
This commit is contained in:
+1
-1
@@ -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
@@ -96,14 +96,27 @@ fn find_frontmatter(node: Node, source: PathBuf) -> Result<Option<Frontmatter>,
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
fn render_index() -> RenderOutput {
|
||||
match render("index.md".into(), "./testdata".into()) {
|
||||
Ok(ro) => ro,
|
||||
Err(e) => {
|
||||
println!("{}", e);
|
||||
panic!();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_rendering_markdown() {
|
||||
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);
|
||||
}
|
||||
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() {
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user