raw
1use crate::{ast::*, parser::parse_markdown};
2
3#[test]
4fn inline_link1() {
5 let doc = parse_markdown("[foo](/url \"title\")").unwrap();
6 assert_eq!(
7 doc,
8 Document {
9 blocks: vec![Block::Paragraph(vec![Inline::Link(Link {
10 destination: "/url".to_owned(),
11 title: Some("title".to_owned()),
12 children: vec![Inline::Text("foo".to_owned())]
13 })])]
14 }
15 );
16}
17
18#[test]
19fn inline_link2() {
20 let doc = parse_markdown("[foo](train.jpg)").unwrap();
21 assert_eq!(
22 doc,
23 Document {
24 blocks: vec![Block::Paragraph(vec![Inline::Link(Link {
25 destination: "train.jpg".to_owned(),
26 title: None,
27 children: vec![Inline::Text("foo".to_owned())]
28 })])]
29 }
30 );
31}
32
33#[test]
34fn inline_link3() {
35 let doc = parse_markdown("[foo](<url>)").unwrap();
36 assert_eq!(
37 doc,
38 Document {
39 blocks: vec![Block::Paragraph(vec![Inline::Link(Link {
40 destination: "url".to_owned(),
41 title: None,
42 children: vec![Inline::Text("foo".to_owned())]
43 })])]
44 }
45 );
46}
47