use crate::fixtures::VimwikiFile;
use std::convert::TryFrom;
use uriparse::URIReference;
use vimwiki_core::*;
#[test]
fn issue_119() {
let contents = VimwikiFile::Issue119.load().unwrap();
let page: Page = Language::from_vimwiki_str(&contents).parse().unwrap();
assert_eq!(
page[0],
Located::from(BlockElement::from(Paragraph::new(vec![
InlineElementContainer::new(vec![
Located::from(InlineElement::from(Text::from(
"some words in front: "
))),
Located::from(InlineElement::from(Link::new_raw_link(
URIReference::try_from("https://example.com/").unwrap()
)))
]),
])))
);
}
#[test]
fn issue_120() {
let contents = VimwikiFile::Issue120.load().unwrap();
let page: Page = Language::from_vimwiki_str(&contents).parse().unwrap();
assert_eq!(
page[0],
Located::from(BlockElement::from(Header::new(
InlineElementContainer::new(vec![Located::from(
InlineElement::from(Text::from("not tags"))
)]),
2,
false,
)))
);
assert_eq!(
page[1],
Located::from(BlockElement::from(Paragraph::new(vec![
InlineElementContainer::new(vec![Located::from(
InlineElement::from(Text::from(
"2021-05-30 12:35:03.913609534-07:00"
))
)]),
])))
);
assert_eq!(
page[2],
Located::from(BlockElement::from(Paragraph::new(vec![
InlineElementContainer::new(vec![Located::from(
InlineElement::from(Text::from("2021-05-30 15:41:15-06:00"))
)]),
])))
);
assert_eq!(
page[3],
Located::from(BlockElement::from(Paragraph::new(vec![
InlineElementContainer::new(vec![Located::from(
InlineElement::from(Text::from("15:41:15"))
)]),
])))
);
assert_eq!(
page[4],
Located::from(BlockElement::from(Paragraph::new(vec![
InlineElementContainer::new(vec![Located::from(
InlineElement::from(Text::from("foo:bar:baz"))
)]),
])))
);
}
#[test]
fn issue_122() {
let contents = VimwikiFile::Issue122.load().unwrap();
let page: Page = Language::from_vimwiki_str(&contents).parse().unwrap();
assert_eq!(
page[0],
Located::from(BlockElement::from(Header::new(
InlineElementContainer::new(vec![Located::from(
InlineElement::from(Text::from("comments"))
)]),
2,
false,
)))
);
assert_eq!(
page[1],
Located::from(BlockElement::from(Paragraph::new(vec![
InlineElementContainer::new(vec![Located::from(
InlineElement::from(Comment::from(LineComment::from(
" this is a comment"
)))
)]),
])))
);
assert_eq!(
page[2],
Located::from(BlockElement::from(Paragraph::new(vec![
InlineElementContainer::new(vec![Located::from(
InlineElement::from(Comment::from(LineComment::from(
" this is a comment with embedded:colons:in"
)))
)]),
])))
);
assert_eq!(
page[3],
Located::from(BlockElement::from(Paragraph::new(vec![
InlineElementContainer::new(vec![Located::from(
InlineElement::from(Comment::from(LineComment::from(
" mark :: 2017-01-04T15:27:39-0700"
)))
)]),
])))
);
}