use orgize::Org; use pretty_assertions::assert_eq; macro_rules! test_suite { ($name:ident, $content:expr, $expected:expr) => { #[test] fn $name() { let mut writer = Vec::new(); let org = Org::parse($content); org.write_html(&mut writer).unwrap(); let string = String::from_utf8(writer).unwrap(); assert_eq!(string, $expected); } }; } test_suite!( emphasis, "*bold*, /italic/,\n_underlined_, =verbatim= and ~code~", "

bold, italic,\nunderlined, \ verbatim and code

" ); test_suite!( link, "Visit[[http://example.com][link1]]or[[http://example.com][link1]].", r#"

Visitlink1orlink1.

"# ); test_suite!( section_and_headline, r#" * title 1 section 1 ** title 2 section 2 * title 3 section 3 * title 4 section 4 "#, "

title 1

section 1

\

title 2

section 2

\

title 3

section 3

\

title 4

section 4

" ); test_suite!( list, r#" + 1 + 2 - 3 - 4 + 5 "#, "
" ); test_suite!( snippet, "@@html:@@delete this@@html:@@", "

delete this

" ); test_suite!( paragraphs, r#" * title paragraph 1 paragraph 2 paragraph 3 paragraph 4 "#, "

title

\

paragraph 1

paragraph 2

\

paragraph 3

paragraph 4

\
" );