diff --git a/Cargo.toml b/Cargo.toml index e7aa6af..4e0ec05 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,4 +10,4 @@ rfd = "0.15.4" thiserror = "2.0.16" toml = "0.9.5" markdown = "1.0.0" -serde = "1.0.219" \ No newline at end of file +serde = { version = "1.0.219", features = ["derive"] } \ No newline at end of file diff --git a/src/renderer.rs b/src/renderer.rs index b91d73c..320f52d 100644 --- a/src/renderer.rs +++ b/src/renderer.rs @@ -96,14 +96,27 @@ fn find_frontmatter(node: Node, source: PathBuf) -> Result, 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("")); // Uses the layout + assert!(contents.matches("Pest Toast").next().is_some()); // Replaces in the title + assert!(contents.matches("").next().is_some()); // Renders the code snippet + assert!(contents.matches("").next().is_some()); // Renders the table + } + + #[test] + fn test_no_layout() { + } } \ No newline at end of file