wip2
This commit is contained in:
+1
-1
@@ -10,4 +10,4 @@ rfd = "0.15.4"
|
|||||||
thiserror = "2.0.16"
|
thiserror = "2.0.16"
|
||||||
toml = "0.9.5"
|
toml = "0.9.5"
|
||||||
markdown = "1.0.0"
|
markdown = "1.0.0"
|
||||||
serde = "1.0.219"
|
serde = { version = "1.0.219", features = ["derive"] }
|
||||||
+20
-7
@@ -96,14 +96,27 @@ fn find_frontmatter(node: Node, source: PathBuf) -> Result<Option<Frontmatter>,
|
|||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
|
fn render_index() -> RenderOutput {
|
||||||
|
match render("index.md".into(), "./testdata".into()) {
|
||||||
|
Ok(ro) => ro,
|
||||||
|
Err(e) => {
|
||||||
|
println!("{}", e);
|
||||||
|
panic!();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_rendering_markdown() {
|
fn test_rendering_markdown() {
|
||||||
match render("index.md".into(), "./testdata".into()) {
|
let RenderOutput { contents, filename } = render_index();
|
||||||
Err(e) => println!("{}", e),
|
assert_eq!(filename.to_str(), Some("index.html")); // Goes to the right filename
|
||||||
Ok(ro) => {
|
assert!(contents.starts_with("<!DOCTYPE html>")); // Uses the layout
|
||||||
println!("File: {}", ro.filename.to_str().unwrap());
|
assert!(contents.matches("Pest Toast").next().is_some()); // Replaces in the title
|
||||||
println!("Contents:\n\n{}", ro.contents);
|
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