use markdown::{mdast, to_html, to_html_with_options, to_mdast, Options}; use pretty_assertions::assert_eq; #[test] fn fuzz() -> Result<(), String> { assert_eq!( to_html("[\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!( to_html_with_options("a@b.c+d@e.f", &Options::gfm())?, "

a@b.c+d@e.f

", "2: gfm: email autolink literals running into each other" ); assert_eq!( to_html(" x\n* "), "
x\n
\n", "3-a: containers should not pierce into indented code" ); assert_eq!( to_html(" a\n* b"), "
a\n
\n", "3-b: containers should not pierce into indented code" ); assert_eq!( to_html("a * "), "

a *

", "4-a: trailing whitespace and broken data" ); assert_eq!( to_html("_ "), "

_

", "4-b: trailing whitespace and broken data (GH-13)" ); assert_eq!( to_html_with_options("a ~ ", &Options::gfm())?, "

a ~

", "4-c: trailing whitespace and broken data (GH-14)" ); assert!( matches!( to_mdast("123456789. ok", &Default::default()), Ok(mdast::Node::Root(_)) ), "5: lists should support high start numbers (GH-17)" ); assert_eq!( to_html("> ```\n"), "
\n
\n
\n
", "6-a: container close after unclosed fenced code, with eol (block quote, GH-16)" ); assert_eq!( to_html("- ```\n"), "", "6-b: container close after unclosed fenced code, with eol (list, GH-16)" ); assert_eq!( to_html_with_options("> x\n``", &Options::gfm()), Ok("
\n

x

\n
\n

``

".into()), "7: lazy container lines almost starting fenced code (GH-19)" ); assert_eq!( to_html_with_options("a\tb@c.d", &Options::gfm()), Ok("

a\tb@c.d

".into()), "8-a: autolink literals after tabs (GH-18)" ); assert_eq!( to_html_with_options("aa\tb@c.d", &Options::gfm()), Ok("

aa\tb@c.d

".into()), "8-b: autolink literals after tabs (GH-18)" ); assert_eq!( to_html_with_options("aaa\tb@c.d", &Options::gfm()), Ok("

aaa\tb@c.d

".into()), "8-c: autolink literals after tabs (GH-18)" ); assert_eq!( to_html_with_options("aaaa\tb@c.d", &Options::gfm()), Ok("

aaaa\tb@c.d

".into()), "8-d: autolink literals after tabs (GH-18)" ); assert_eq!( to_html_with_options("| a |\n| - |\n| www.a|", &Options::gfm()), Ok("\n\n\n\n\n\n\n\n\n\n\n
a
www.a
".into()), "9: autolink literals that end in table cell delimiter (GH-20)" ); assert_eq!( to_html_with_options("[*]() [*]()", &Options::gfm()), Ok("

* *

".into()), "10: attention in different links (GH-21)" ); assert!( matches!( to_mdast("* [ ]\na", &Default::default()), Ok(mdast::Node::Root(_)) ), "11: gfm task list items followed by eols (GH-24)" ); Ok(()) }