aboutsummaryrefslogtreecommitdiffstats
path: root/tests/misc_zero.rs
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-12-13 12:31:18 +0400
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-12-13 12:31:18 +0400
commit60410a42e46d97e3581493c9d185184b7fd87bb5 (patch)
treee57782fd4c028e3443647403c534dc8d2bbb7710 /tests/misc_zero.rs
parentf87525c39d631f99f879c0be761af1ca39524952 (diff)
downloadmarkdown-rs-60410a42e46d97e3581493c9d185184b7fd87bb5.tar.gz
markdown-rs-60410a42e46d97e3581493c9d185184b7fd87bb5.tar.bz2
markdown-rs-60410a42e46d97e3581493c9d185184b7fd87bb5.zip
Add test for empty ast
Diffstat (limited to 'tests/misc_zero.rs')
-rw-r--r--tests/misc_zero.rs19
1 files 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() {
"<p>\\0</p>",
"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(())
}