Skip to content

Commit 60410a4

Browse files
committed
Add test for empty ast
1 parent f87525c commit 60410a4

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

tests/misc_zero.rs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1-
use markdown::to_html;
1+
use markdown::{
2+
mdast::{Node, Root},
3+
to_html, to_mdast,
4+
unist::Position,
5+
};
26
use pretty_assertions::assert_eq;
37

48
#[test]
5-
fn zero() {
9+
fn zero() -> Result<(), String> {
610
assert_eq!(to_html(""), "", "should support no markdown");
711

812
assert_eq!(
@@ -24,4 +28,15 @@ fn zero() {
2428
"<p>\\0</p>",
2529
"should not support NUL in a character escape"
2630
);
31+
32+
assert_eq!(
33+
to_mdast("", &Default::default())?,
34+
Node::Root(Root {
35+
children: vec![],
36+
position: Some(Position::new(1, 1, 0, 1, 1, 0))
37+
}),
38+
"should support no markdown (ast)"
39+
);
40+
41+
Ok(())
2742
}

0 commit comments

Comments
 (0)