diff options
author | Titus Wormer <tituswormer@gmail.com> | 2022-10-13 18:14:35 +0200 |
---|---|---|
committer | Titus Wormer <tituswormer@gmail.com> | 2022-10-13 18:14:35 +0200 |
commit | 15f5ef7e8ceefbca75215141fc33136ac25f86c3 (patch) | |
tree | 251d97872e61b0170d0a0acf2473d474c7c22668 /src/mdast.rs | |
parent | 2f21280db96e9c8086e123f756f5cad27cbfa0bf (diff) | |
download | markdown-rs-15f5ef7e8ceefbca75215141fc33136ac25f86c3.tar.gz markdown-rs-15f5ef7e8ceefbca75215141fc33136ac25f86c3.tar.bz2 markdown-rs-15f5ef7e8ceefbca75215141fc33136ac25f86c3.zip |
Add missing test for mdast
Diffstat (limited to 'src/mdast.rs')
-rw-r--r-- | src/mdast.rs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/mdast.rs b/src/mdast.rs index a7d887a..559ff62 100644 --- a/src/mdast.rs +++ b/src/mdast.rs @@ -1950,6 +1950,38 @@ mod tests { } #[test] + fn link_reference() { + let mut node = Node::LinkReference(LinkReference { + position: None, + identifier: "a".into(), + label: None, + reference_kind: ReferenceKind::Full, + children: vec![], + }); + + assert_eq!( + format!("{:?}", node), + "LinkReference { children: [], position: None, reference_kind: Full, identifier: \"a\", label: None }", + "should support `Debug`" + ); + assert_eq!(node.to_string(), "", "should support `ToString`"); + assert_eq!( + node.children_mut(), + Some(&mut vec![]), + "should support `children_mut`" + ); + assert_eq!(node.children(), Some(&vec![]), "should support `children`"); + assert_eq!(node.position(), None, "should support `position`"); + assert_eq!(node.position_mut(), None, "should support `position`"); + node.position_set(Some(Position::new(1, 1, 0, 1, 2, 1))); + assert_eq!( + format!("{:?}", node), + "LinkReference { children: [], position: Some(1:1-1:2 (0-1)), reference_kind: Full, identifier: \"a\", label: None }", + "should support `position_set`" + ); + } + + #[test] fn link() { let mut node = Node::Link(Link { position: None, |