aboutsummaryrefslogtreecommitdiffstats
path: root/tests/definition.rs
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-09-07 15:53:06 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-09-07 15:53:06 +0200
commit1d92666865b35341e076efbefddf6e73b5e1542e (patch)
tree11c05985ec7679f73473e7ea2c769465698e2f08 /tests/definition.rs
parente6018e52ee6ad9a8f8a0672b75bf515faf74af1f (diff)
downloadmarkdown-rs-1d92666865b35341e076efbefddf6e73b5e1542e.tar.gz
markdown-rs-1d92666865b35341e076efbefddf6e73b5e1542e.tar.bz2
markdown-rs-1d92666865b35341e076efbefddf6e73b5e1542e.zip
Add support for recoverable syntax errors
Diffstat (limited to 'tests/definition.rs')
-rw-r--r--tests/definition.rs13
1 files changed, 7 insertions, 6 deletions
diff --git a/tests/definition.rs b/tests/definition.rs
index 589994d..11f783d 100644
--- a/tests/definition.rs
+++ b/tests/definition.rs
@@ -3,7 +3,7 @@ use micromark::{micromark, micromark_with_options, Constructs, Options};
use pretty_assertions::assert_eq;
#[test]
-fn definition() {
+fn definition() -> Result<(), String> {
let danger = Options {
allow_dangerous_html: true,
allow_dangerous_protocol: true,
@@ -77,7 +77,7 @@ fn definition() {
);
assert_eq!(
- micromark_with_options("[foo]: <bar>(baz)\n\n[foo]", &danger),
+ micromark_with_options("[foo]: <bar>(baz)\n\n[foo]", &danger)?,
"<p>[foo]: <bar>(baz)</p>\n<p>[foo]</p>",
"should not support definitions w/ no whitespace between destination and title"
);
@@ -211,8 +211,7 @@ fn definition() {
assert_eq!(
micromark(
- "[foo]: /foo-url \"foo\"\n[bar]: /bar-url\n \"bar\"\n[baz]: /baz-url\n\n[foo],\n[bar],\n[baz]"
- ),
+ "[foo]: /foo-url \"foo\"\n[bar]: /bar-url\n \"bar\"\n[baz]: /baz-url\n\n[foo],\n[bar],\n[baz]"),
"<p><a href=\"/foo-url\" title=\"foo\">foo</a>,\n<a href=\"/bar-url\" title=\"bar\">bar</a>,\n<a href=\"/baz-url\">baz</a></p>",
"should support definitions after definitions"
);
@@ -370,7 +369,7 @@ fn definition() {
);
assert_eq!(
- micromark_with_options("[a]\n\n[a]: <b<c>", &danger),
+ micromark_with_options("[a]\n\n[a]: <b<c>", &danger)?,
"<p>[a]</p>\n<p>[a]: &lt;b<c></p>",
"should not support a less than in an enclosed destination"
);
@@ -451,8 +450,10 @@ fn definition() {
},
..Options::default()
}
- ),
+ )?,
"<p>[foo]: /url &quot;title&quot;</p>",
"should support turning off definitions"
);
+
+ Ok(())
}