From 60410a42e46d97e3581493c9d185184b7fd87bb5 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Tue, 13 Dec 2022 12:31:18 +0400 Subject: Add test for empty ast --- tests/misc_zero.rs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/tests/misc_zero.rs b/tests/misc_zero.rs index dbe0836..ed9f1bc 100644 --- a/tests/misc_zero.rs +++ b/tests/misc_zero.rs @@ -1,8 +1,12 @@ -use markdown::to_html; +use markdown::{ + mdast::{Node, Root}, + to_html, to_mdast, + unist::Position, +}; use pretty_assertions::assert_eq; #[test] -fn zero() { +fn zero() -> Result<(), String> { assert_eq!(to_html(""), "", "should support no markdown"); assert_eq!( @@ -24,4 +28,15 @@ fn zero() { "

\\0

", "should not support NUL in a character escape" ); + + assert_eq!( + to_mdast("", &Default::default())?, + Node::Root(Root { + children: vec![], + position: Some(Position::new(1, 1, 0, 1, 1, 0)) + }), + "should support no markdown (ast)" + ); + + Ok(()) } -- cgit