-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
30 additions
and
1 deletion.
There are no files selected for viewing
31 changes: 30 additions & 1 deletion
31
crates/swc_ecma_transforms_proposal/tests/explicit_resource_management.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,37 @@ | ||
use std::path::PathBuf; | ||
|
||
use swc_common::{chain, Mark}; | ||
use swc_ecma_parser::{EsConfig, Syntax}; | ||
use swc_ecma_transforms_base::resolver; | ||
use swc_ecma_transforms_proposal::explicit_resource_management::explicit_resource_management; | ||
use swc_ecma_transforms_testing::{test_fixture, FixtureTestConfig}; | ||
|
||
#[testing::fixture("tests/explicit-resource_management/**/input.js")] | ||
fn fixture(input: PathBuf) { | ||
run(input); | ||
} | ||
|
||
fn run(input: PathBuf) {} | ||
fn run(input: PathBuf) { | ||
let output = input.with_extension("output.js"); | ||
|
||
test_fixture( | ||
Syntax::Es(EsConfig { | ||
using_decl: true, | ||
..Default::default() | ||
}), | ||
&|_t| { | ||
let unresolved_mark = Mark::new(); | ||
let top_level_mark = Mark::new(); | ||
|
||
chain!( | ||
resolver(unresolved_mark, top_level_mark, false), | ||
explicit_resource_management() | ||
) | ||
}, | ||
&input, | ||
&output, | ||
FixtureTestConfig { | ||
..Default::default() | ||
}, | ||
); | ||
} |