extern crate micromark;
use micromark::{
micromark, micromark_with_options, CompileOptions, Constructs, Options, ParseOptions,
};
use pretty_assertions::assert_eq;
#[test]
fn fuzz() -> Result<(), String> {
assert_eq!(
micromark("[\n~\na\n-\n\n"),
"
[\n~\na
\n",
"1: label, blank lines, and code"
);
// The first link is stopped by the `+` (so it’s `a@b.c`), but the next
// link overlaps it (`b.c+d@e.f`).
assert_eq!(
micromark_with_options(
"a@b.c+d@e.f",
&Options {
parse: ParseOptions {
constructs: Constructs::gfm(),
..ParseOptions::default()
},
compile: CompileOptions {
gfm_tagfilter: true,
..CompileOptions::default()
}
}
)?,
"a@b.c+d@e.f
",
"2: gfm: email autolink literals running into each other"
);
assert_eq!(
micromark(" x\n* "),
"x\n
\n",
"3-a: containers should not pierce into indented code"
);
assert_eq!(
micromark(" a\n* b"),
"a\n
\n",
"3-b: containers should not pierce into indented code"
);
Ok(())
}