aboutsummaryrefslogtreecommitdiffstats
path: root/tests/math_text.rs
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-10-06 15:57:55 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-10-06 15:57:55 +0200
commitcd5bb2d16c6b28332b0b6077b27b2b90a8051896 (patch)
tree848ebc6200b80d2dfdcd67bf0bb245eea06bb24f /tests/math_text.rs
parent6e80e03bb6d6af47aba2b339f160e4895ab5afba (diff)
downloadmarkdown-rs-cd5bb2d16c6b28332b0b6077b27b2b90a8051896.tar.gz
markdown-rs-cd5bb2d16c6b28332b0b6077b27b2b90a8051896.tar.bz2
markdown-rs-cd5bb2d16c6b28332b0b6077b27b2b90a8051896.zip
Refactor to split parse from compile options
Diffstat (limited to '')
-rw-r--r--tests/math_text.rs47
1 files changed, 29 insertions, 18 deletions
diff --git a/tests/math_text.rs b/tests/math_text.rs
index 76aa0aa..6282181 100644
--- a/tests/math_text.rs
+++ b/tests/math_text.rs
@@ -3,17 +3,20 @@ use micromark::{
mdast::{InlineMath, Node, Paragraph, Root, Text},
micromark, micromark_to_mdast, micromark_with_options,
unist::Position,
- Constructs, Options,
+ CompileOptions, Constructs, Options, ParseOptions,
};
use pretty_assertions::assert_eq;
#[test]
fn math_text() -> Result<(), String> {
let math = Options {
- constructs: Constructs {
- math_text: true,
- math_flow: true,
- ..Constructs::default()
+ parse: ParseOptions {
+ constructs: Constructs {
+ math_text: true,
+ math_flow: true,
+ ..Constructs::default()
+ },
+ ..ParseOptions::default()
},
..Options::default()
};
@@ -34,11 +37,14 @@ fn math_text() -> Result<(), String> {
micromark_with_options(
"$foo$ $$bar$$",
&Options {
- math_text_single_dollar: false,
- constructs: Constructs {
- math_text: true,
- math_flow: true,
- ..Constructs::default()
+ parse: ParseOptions {
+ constructs: Constructs {
+ math_text: true,
+ math_flow: true,
+ ..Constructs::default()
+ },
+ math_text_single_dollar: false,
+ ..ParseOptions::default()
},
..Options::default()
}
@@ -141,14 +147,19 @@ fn math_text() -> Result<(), String> {
micromark_with_options(
"<a href=\"$\">$",
&Options {
- allow_dangerous_html: true,
- allow_dangerous_protocol: true,
- constructs: Constructs {
- math_text: true,
- math_flow: true,
- ..Constructs::default()
+ parse: ParseOptions {
+ constructs: Constructs {
+ math_text: true,
+ math_flow: true,
+ ..Constructs::default()
+ },
+ ..ParseOptions::default()
},
- ..Options::default()
+ compile: CompileOptions {
+ allow_dangerous_html: true,
+ allow_dangerous_protocol: true,
+ ..CompileOptions::default()
+ }
}
)?,
"<p><a href=\"$\">$</p>",
@@ -198,7 +209,7 @@ fn math_text() -> Result<(), String> {
);
assert_eq!(
- micromark_to_mdast("a $alpha$ b.", &math)?,
+ micromark_to_mdast("a $alpha$ b.", &math.parse)?,
Node::Root(Root {
children: vec![Node::Paragraph(Paragraph {
children: vec![