aboutsummaryrefslogtreecommitdiffstats
path: root/tests/mdx_expression_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/mdx_expression_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 'tests/mdx_expression_text.rs')
-rw-r--r--tests/mdx_expression_text.rs27
1 files changed, 18 insertions, 9 deletions
diff --git a/tests/mdx_expression_text.rs b/tests/mdx_expression_text.rs
index 9eb9dbf..d893a70 100644
--- a/tests/mdx_expression_text.rs
+++ b/tests/mdx_expression_text.rs
@@ -4,7 +4,7 @@ use micromark::{
mdast::{MdxTextExpression, Node, Paragraph, Root, Text},
micromark_to_mdast, micromark_with_options,
unist::Position,
- Constructs, Options,
+ Constructs, Options, ParseOptions,
};
use pretty_assertions::assert_eq;
use test_utils::swc::{parse_esm, parse_expression};
@@ -12,9 +12,12 @@ use test_utils::swc::{parse_esm, parse_expression};
#[test]
fn mdx_expression_text_gnostic_core() -> Result<(), String> {
let swc = Options {
- constructs: Constructs::mdx(),
- mdx_esm_parse: Some(Box::new(parse_esm)),
- mdx_expression_parse: Some(Box::new(parse_expression)),
+ parse: ParseOptions {
+ constructs: Constructs::mdx(),
+ mdx_esm_parse: Some(Box::new(parse_esm)),
+ mdx_expression_parse: Some(Box::new(parse_expression)),
+ ..ParseOptions::default()
+ },
..Options::default()
};
@@ -148,7 +151,10 @@ fn mdx_expression_text_gnostic_core() -> Result<(), String> {
#[test]
fn mdx_expression_text_agnostic() -> Result<(), String> {
let mdx = Options {
- constructs: Constructs::mdx(),
+ parse: ParseOptions {
+ constructs: Constructs::mdx(),
+ ..ParseOptions::default()
+ },
..Options::default()
};
@@ -197,7 +203,7 @@ fn mdx_expression_text_agnostic() -> Result<(), String> {
);
assert_eq!(
- micromark_to_mdast("a {alpha} b.", &mdx)?,
+ micromark_to_mdast("a {alpha} b.", &mdx.parse)?,
Node::Root(Root {
children: vec![Node::Paragraph(Paragraph {
children: vec![
@@ -227,9 +233,12 @@ fn mdx_expression_text_agnostic() -> Result<(), String> {
#[test]
fn mdx_expression_text_gnostic() -> Result<(), String> {
let swc = Options {
- constructs: Constructs::mdx(),
- mdx_esm_parse: Some(Box::new(parse_esm)),
- mdx_expression_parse: Some(Box::new(parse_expression)),
+ parse: ParseOptions {
+ constructs: Constructs::mdx(),
+ mdx_esm_parse: Some(Box::new(parse_esm)),
+ mdx_expression_parse: Some(Box::new(parse_expression)),
+ ..ParseOptions::default()
+ },
..Options::default()
};