Skip to content

Commit

Permalink
test_fixture
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 committed Jun 20, 2023
1 parent fed116f commit dffab9f
Showing 1 changed file with 30 additions and 1 deletion.
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()
},
);
}

0 comments on commit dffab9f

Please sign in to comment.