Skip to content

Commit

Permalink
test(es/compat): Add a test to verify parameters passs (#6792)
Browse files Browse the repository at this point in the history
**Related issue:**

 - Closes #6790.
  • Loading branch information
kdy1 committed Jan 12, 2023
1 parent 288ec1d commit 7dc5ccb
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
23 changes: 22 additions & 1 deletion crates/swc_ecma_transforms_compat/tests/es2015_parameters.rs
@@ -1,3 +1,5 @@
use std::path::PathBuf;

use swc_common::{chain, comments::SingleThreadedComments, Mark};
use swc_ecma_parser::Syntax;
use swc_ecma_transforms_base::resolver;
Expand All @@ -7,7 +9,7 @@ use swc_ecma_transforms_compat::{
},
es2017::async_to_generator,
};
use swc_ecma_transforms_testing::{test, test_exec};
use swc_ecma_transforms_testing::{test, test_exec, test_fixture};
use swc_ecma_visit::Fold;

fn syntax() -> Syntax {
Expand Down Expand Up @@ -2308,3 +2310,22 @@ test!(
console.log(v0(1, 2, 'hello', true, 7));
"#
);

#[testing::fixture("tests/parameters/**/input.js")]
fn fixture(input: PathBuf) {
let output = input.with_file_name("output.js");

test_fixture(
Default::default(),
&|_| {
let unresolved_mark = Mark::new();
chain!(
resolver(unresolved_mark, Mark::new(), false),
parameters(Default::default(), unresolved_mark)
)
},
&input,
&output,
Default::default(),
);
}
@@ -0,0 +1,3 @@
async function internalMutate(...args) {
const [cache, _key, _data, _opts] = args;
}
@@ -0,0 +1,6 @@
async function internalMutate() {
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
args[_key] = arguments[_key];
}
const [cache, _key1, _data, _opts] = args;
}

0 comments on commit 7dc5ccb

Please sign in to comment.