diff options
author | Titus Wormer <tituswormer@gmail.com> | 2022-09-07 15:53:06 +0200 |
---|---|---|
committer | Titus Wormer <tituswormer@gmail.com> | 2022-09-07 15:53:06 +0200 |
commit | 1d92666865b35341e076efbefddf6e73b5e1542e (patch) | |
tree | 11c05985ec7679f73473e7ea2c769465698e2f08 /tests/gfm_strikethrough.rs | |
parent | e6018e52ee6ad9a8f8a0672b75bf515faf74af1f (diff) | |
download | markdown-rs-1d92666865b35341e076efbefddf6e73b5e1542e.tar.gz markdown-rs-1d92666865b35341e076efbefddf6e73b5e1542e.tar.bz2 markdown-rs-1d92666865b35341e076efbefddf6e73b5e1542e.zip |
Add support for recoverable syntax errors
Diffstat (limited to 'tests/gfm_strikethrough.rs')
-rw-r--r-- | tests/gfm_strikethrough.rs | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/tests/gfm_strikethrough.rs b/tests/gfm_strikethrough.rs index f39be07..b8c3e1f 100644 --- a/tests/gfm_strikethrough.rs +++ b/tests/gfm_strikethrough.rs @@ -3,7 +3,7 @@ use micromark::{micromark, micromark_with_options, Constructs, Options}; use pretty_assertions::assert_eq; #[test] -fn gfm_strikethrough() { +fn gfm_strikethrough() -> Result<(), String> { let gfm = Options { constructs: Constructs::gfm(), ..Options::default() @@ -16,49 +16,49 @@ fn gfm_strikethrough() { ); assert_eq!( - micromark_with_options("a ~b~", &gfm), + micromark_with_options("a ~b~", &gfm)?, "<p>a <del>b</del></p>", "should support strikethrough w/ one tilde" ); assert_eq!( - micromark_with_options("a ~~b~~", &gfm), + micromark_with_options("a ~~b~~", &gfm)?, "<p>a <del>b</del></p>", "should support strikethrough w/ two tildes" ); assert_eq!( - micromark_with_options("a ~~~b~~~", &gfm), + micromark_with_options("a ~~~b~~~", &gfm)?, "<p>a ~~~b~~~</p>", "should not support strikethrough w/ three tildes" ); assert_eq!( - micromark_with_options("a \\~~~b~~ c", &gfm), + micromark_with_options("a \\~~~b~~ c", &gfm)?, "<p>a ~<del>b</del> c</p>", "should support strikethrough after an escaped tilde" ); assert_eq!( - micromark_with_options("a ~~b ~~c~~ d~~ e", &gfm), + micromark_with_options("a ~~b ~~c~~ d~~ e", &gfm)?, "<p>a <del>b <del>c</del> d</del> e</p>", "should support nested strikethrough" ); assert_eq!( - micromark_with_options("a ~-1~ b", &gfm), + micromark_with_options("a ~-1~ b", &gfm)?, "<p>a <del>-1</del> b</p>", "should open if preceded by whitespace and followed by punctuation" ); assert_eq!( - micromark_with_options("a ~b.~ c", &gfm), + micromark_with_options("a ~b.~ c", &gfm)?, "<p>a <del>b.</del> c</p>", "should close if preceded by punctuation and followed by whitespace" ); assert_eq!( - micromark_with_options("~b.~.", &gfm), + micromark_with_options("~b.~.", &gfm)?, "<p><del>b.</del>.</p>", "should close if preceded and followed by punctuation" ); @@ -123,7 +123,7 @@ a ~~two b one~ c two~~ d a ~~two b two~~ c one~ d "###, &gfm - ), + )?, r###"<h1>Balanced</h1> <p>a <del>one</del> b</p> <p>a <del>two</del> b</p> @@ -192,7 +192,7 @@ a ~~twoLeft b ~~twoLeft c twoRight~~ d a ~~twoLeft b ~~twoLeft c ~~twoLeft d "###, &gfm - ), + )?, r###"<h1>Flank</h1> <p>a oneRight~ b oneRight~ c oneRight~ d</p> <p>a oneRight~ b oneRight~ c ~oneLeft d</p> @@ -309,7 +309,7 @@ t ~~**xxx**~~ zzz u ~**xxx**~ zzz "###, &gfm - ), + )?, r###"<h1>Interlpay</h1> <h2>Interleave with attention</h2> <p>a <del>two <em>emphasis</em> two</del> b</p> @@ -367,7 +367,7 @@ u ~**xxx**~ zzz gfm_strikethrough_single_tilde: false, ..Options::default() } - ), + )?, "<p>a ~b~ <del>c</del> d</p>", "should not support strikethrough w/ one tilde if `singleTilde: false`" ); @@ -380,8 +380,10 @@ u ~**xxx**~ zzz gfm_strikethrough_single_tilde: true, ..Options::default() } - ), + )?, "<p>a <del>b</del> <del>c</del> d</p>", "should support strikethrough w/ one tilde if `singleTilde: true`" ); + + Ok(()) } |