test(es/compat): Add a test to verify parameters passs (#6792)

**Related issue:**

 - Closes https://github.com/swc-project/swc/issues/6790.
This commit is contained in:
Donny/강동윤 2023-01-12 15:54:36 +09:00 committed by GitHub
parent 288ec1d6e0
commit 7dc5ccb0fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 1 deletions

View File

@ -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;
@ -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 {
@ -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(),
);
}

View File

@ -0,0 +1,3 @@
async function internalMutate(...args) {
const [cache, _key, _data, _opts] = args;
}

View File

@ -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;
}