use orgize::Org; use pretty_assertions::assert_eq; use std::io::Result; macro_rules! test_suite { ($name:ident, $content:expr, $expected:expr) => { #[test] fn $name() -> Result<()> { let mut writer = Vec::new(); let org = Org::parse($content); org.html(&mut writer).unwrap(); let string = String::from_utf8(writer).unwrap(); assert_eq!(string, $expected); Ok(()) } }; } test_suite!( emphasis, "*bold*, /italic/,\n_underlined_, =verbatim= and ~code~", "bold, italic,\nunderlined, \ verbatim and code" ); 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"#, "\ 1\ 234\ 5\ " ); test_suite!( snippet, "@@html:@@delete this@@html:@@", "delete this" );
bold, italic,\nunderlined, \ verbatim and code
verbatim
code
Section 1
Section 2
Section 3
Section 4
1
2
3
4
5
delete this