aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_utils/jsx_rewrite.rs
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-10-11 16:27:38 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-10-11 16:27:38 +0200
commite484d1ecc5e405259767c0fd84072226fee40b71 (patch)
tree71d2a2f67870052aa026d0087dfb06cb96c40e17 /tests/test_utils/jsx_rewrite.rs
parent73d8609565b808ac73df5ac34e6d4f7f23c25ad6 (diff)
downloadmarkdown-rs-e484d1ecc5e405259767c0fd84072226fee40b71.tar.gz
markdown-rs-e484d1ecc5e405259767c0fd84072226fee40b71.tar.bz2
markdown-rs-e484d1ecc5e405259767c0fd84072226fee40b71.zip
Refactor test utilities to improve names
Diffstat (limited to '')
-rw-r--r--tests/test_utils/mdx_plugin_recma_jsx_rewrite.rs (renamed from tests/test_utils/jsx_rewrite.rs)11
1 files changed, 8 insertions, 3 deletions
diff --git a/tests/test_utils/jsx_rewrite.rs b/tests/test_utils/mdx_plugin_recma_jsx_rewrite.rs
index 33879b0..6a4d451 100644
--- a/tests/test_utils/jsx_rewrite.rs
+++ b/tests/test_utils/mdx_plugin_recma_jsx_rewrite.rs
@@ -1,11 +1,16 @@
+//! Rewrite JSX tags to accept them from props and an optional provider.
+//!
+//! Port of <https://github.com/mdx-js/mdx/blob/main/packages/mdx/lib/plugin/recma-jsx-rewrite.js>,
+//! by the same author.
+
extern crate swc_common;
extern crate swc_ecma_ast;
use crate::test_utils::{
- micromark_swc_utils::{position_to_string, span_to_position},
+ hast_util_to_swc::Program,
swc_utils::{
create_binary_expression, create_ident, create_ident_expression, create_member_expression,
+ position_to_string, span_to_position,
},
- to_swc::Program,
};
use micromark::{id_cont, id_start, unist::Position, Location};
use swc_ecma_visit::{noop_visit_mut_type, VisitMut, VisitMutWith};
@@ -25,7 +30,7 @@ pub struct Options {
/// Rewrite JSX in an MDX file so that components can be passed in and provided.
#[allow(dead_code)]
-pub fn jsx_rewrite(
+pub fn mdx_plugin_recma_jsx_rewrite(
mut program: Program,
options: &Options,
location: Option<&Location>,