sable-markdown/src/parser/inline/tests/image.rs@main
raw
1use crate::{ast::*, parser::parse_markdown};
2
3#[test]
4fn image1() {
5 let doc = parse_markdown("").unwrap();
6 assert_eq!(
7 doc,
8 Document {
9 blocks: vec![Block::Paragraph(vec![Inline::Image(Image {
10 destination: "/url".to_owned(),
11 title: Some("title".to_owned()),
12 alt: "foo".to_owned(),
13 })])]
14 }
15 );
16}
17
18#[test]
19fn image2() {
20 let doc = parse_markdown("").unwrap();
21 assert_eq!(
22 doc,
23 Document {
24 blocks: vec![Block::Paragraph(vec![Inline::Image(Image {
25 destination: "train.jpg".to_owned(),
26 title: None,
27 alt: "foo".to_owned(),
28 })])]
29 }
30 );
31}
32
33#[test]
34fn image3() {
35 let doc = parse_markdown("").unwrap();
36 assert_eq!(
37 doc,
38 Document {
39 blocks: vec![Block::Paragraph(vec![Inline::Image(Image {
40 destination: "url".to_owned(),
41 title: None,
42 alt: "foo".to_owned(),
43 })])]
44 }
45 );
46}
47
48#[test]
49fn image4() {
50 let doc = parse_markdown("").unwrap();
51 assert_eq!(
52 doc,
53 Document {
54 blocks: vec![Block::Paragraph(vec![Inline::Image(Image {
55 destination: "train.jpg".to_owned(),
56 title: None,
57 alt: String::new(),
58 })])]
59 }
60 );
61}
62