From 57c3cda9f98e70a9f614a22eb6d518051cc60b19 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Mon, 12 Sep 2022 17:18:30 +0200 Subject: Fix gfm email autolink literals overlapping --- tests/fuzz.rs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'tests/fuzz.rs') diff --git a/tests/fuzz.rs b/tests/fuzz.rs index 3cc1066..126032a 100644 --- a/tests/fuzz.rs +++ b/tests/fuzz.rs @@ -1,5 +1,5 @@ extern crate micromark; -use micromark::micromark; +use micromark::{micromark, micromark_with_options, Constructs, Options}; use pretty_assertions::assert_eq; #[test] @@ -7,7 +7,22 @@ fn fuzz() -> Result<(), String> { assert_eq!( micromark("[\n~\na\n-\n\n"), "

[\n~\na

\n\n", - "1" + "1: label, blank lines, and code" + ); + + assert_eq!( + // The first link is stopped by the `+` (so it’s `a@b.c`), but the next + // link overlaps it (`b.c+d@e.f`). + micromark_with_options( + "a@b.c+d@e.f", + &Options { + constructs: Constructs::gfm(), + gfm_tagfilter: true, + ..Options::default() + } + )?, + "

a@b.c+d@e.f

", + "2: gfm: email autolink literals running into each other" ); Ok(()) -- cgit