diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_utils/mdx_plugin_recma_document.rs | 6 | ||||
-rw-r--r-- | tests/test_utils/mdx_plugin_recma_jsx_rewrite.rs | 6 | ||||
-rw-r--r-- | tests/xxx_mdx_plugin_recma_document.rs | 7 | ||||
-rw-r--r-- | tests/xxx_mdx_plugin_recma_jsx_rewrite.rs | 9 |
4 files changed, 12 insertions, 16 deletions
diff --git a/tests/test_utils/mdx_plugin_recma_document.rs b/tests/test_utils/mdx_plugin_recma_document.rs index a62862c..5c0d423 100644 --- a/tests/test_utils/mdx_plugin_recma_document.rs +++ b/tests/test_utils/mdx_plugin_recma_document.rs @@ -72,10 +72,10 @@ impl Default for Options { #[allow(dead_code)] pub fn mdx_plugin_recma_document( - mut program: Program, + program: &mut Program, options: &Options, location: Option<&Location>, -) -> Result<Program, String> { +) -> Result<(), String> { // New body children. let mut replacements = vec![]; @@ -412,7 +412,7 @@ pub fn mdx_plugin_recma_document( program.module.body = replacements; - Ok(program) + Ok(()) } /// Create a content component. diff --git a/tests/test_utils/mdx_plugin_recma_jsx_rewrite.rs b/tests/test_utils/mdx_plugin_recma_jsx_rewrite.rs index 6a4d451..89e0ebd 100644 --- a/tests/test_utils/mdx_plugin_recma_jsx_rewrite.rs +++ b/tests/test_utils/mdx_plugin_recma_jsx_rewrite.rs @@ -31,10 +31,10 @@ pub struct Options { /// Rewrite JSX in an MDX file so that components can be passed in and provided. #[allow(dead_code)] pub fn mdx_plugin_recma_jsx_rewrite( - mut program: Program, + program: &mut Program, options: &Options, location: Option<&Location>, -) -> Program { +) { let mut state = State { scopes: vec![], location, @@ -65,8 +65,6 @@ pub fn mdx_plugin_recma_jsx_rewrite( .body .push(create_error_helper(state.development, state.path)); } - - program } /// Collection of different SWC functions. diff --git a/tests/xxx_mdx_plugin_recma_document.rs b/tests/xxx_mdx_plugin_recma_document.rs index 1cb91fe..9106c50 100644 --- a/tests/xxx_mdx_plugin_recma_document.rs +++ b/tests/xxx_mdx_plugin_recma_document.rs @@ -24,10 +24,9 @@ fn from_markdown(value: &str) -> Result<String, String> { }, )?; let hast = mdast_util_to_hast(&mdast); - let program = hast_util_to_swc(&hast, None, Some(&location))?; - let program = mdx_plugin_recma_document(program, &DocumentOptions::default(), Some(&location))?; - let value = serialize(&program.module); - Ok(value) + let mut program = hast_util_to_swc(&hast, None, Some(&location))?; + mdx_plugin_recma_document(&mut program, &DocumentOptions::default(), Some(&location))?; + Ok(serialize(&program.module)) } #[test] diff --git a/tests/xxx_mdx_plugin_recma_jsx_rewrite.rs b/tests/xxx_mdx_plugin_recma_jsx_rewrite.rs index 497155f..b1d2ca8 100644 --- a/tests/xxx_mdx_plugin_recma_jsx_rewrite.rs +++ b/tests/xxx_mdx_plugin_recma_jsx_rewrite.rs @@ -25,11 +25,10 @@ fn from_markdown(value: &str, options: &RewriteOptions) -> Result<String, String }, )?; let hast = mdast_util_to_hast(&mdast); - let program = hast_util_to_swc(&hast, Some("example.mdx".into()), Some(&location))?; - let program = mdx_plugin_recma_document(program, &DocumentOptions::default(), Some(&location))?; - let program = mdx_plugin_recma_jsx_rewrite(program, options, Some(&location)); - let value = serialize(&program.module); - Ok(value) + let mut program = hast_util_to_swc(&hast, Some("example.mdx".into()), Some(&location))?; + mdx_plugin_recma_document(&mut program, &DocumentOptions::default(), Some(&location))?; + mdx_plugin_recma_jsx_rewrite(&mut program, options, Some(&location)); + Ok(serialize(&program.module)) } #[test] |