aboutsummaryrefslogtreecommitdiffstats
path: root/tests/fuzz.rs
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-09-12 17:18:30 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-09-12 17:18:30 +0200
commit57c3cda9f98e70a9f614a22eb6d518051cc60b19 (patch)
tree7067e1f12cc8ca3c8002ae509f3b327d84b2ac04 /tests/fuzz.rs
parentf7d7507af61a0f253fdb50cecd20885b72d16b13 (diff)
downloadmarkdown-rs-57c3cda9f98e70a9f614a22eb6d518051cc60b19.tar.gz
markdown-rs-57c3cda9f98e70a9f614a22eb6d518051cc60b19.tar.bz2
markdown-rs-57c3cda9f98e70a9f614a22eb6d518051cc60b19.zip
Fix gfm email autolink literals overlapping
Diffstat (limited to '')
-rw-r--r--tests/fuzz.rs19
1 files changed, 17 insertions, 2 deletions
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"),
"<p>[\n~\na</p>\n<ul>\n<li></li>\n</ul>\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()
+ }
+ )?,
+ "<p><a href=\"mailto:a@b.c\">a@b.c</a><a href=\"mailto:+d@e.f\">+d@e.f</a></p>",
+ "2: gfm: email autolink literals running into each other"
);
Ok(())