mirror of
https://github.com/swc-project/swc.git
synced 2024-11-24 10:12:42 +03:00
Fix tests (#142)
This commit is contained in:
parent
605019280f
commit
ab4f619257
@ -92,7 +92,7 @@ fn emit_colors(b: &mut Bencher) {
|
||||
|
||||
let _ = ::testing::run_test(true, |cm, handler| {
|
||||
let session = Session { handler: &handler };
|
||||
let fm = cm.new_source_file(FileName::Anon(0), SOURCE.into());
|
||||
let fm = cm.new_source_file(FileName::Anon, SOURCE.into());
|
||||
let mut parser = Parser::new(
|
||||
session,
|
||||
Syntax::default(),
|
||||
|
@ -55,7 +55,7 @@ fn bench_module(b: &mut Bencher, src: &'static str) {
|
||||
|
||||
let _ = ::testing::run_test(false, |cm, handler| {
|
||||
let session = Session { handler: &handler };
|
||||
let fm = cm.new_source_file(FileName::Anon(0), src.into());
|
||||
let fm = cm.new_source_file(FileName::Anon, src.into());
|
||||
|
||||
b.iter(|| {
|
||||
let _ = test::black_box({
|
||||
|
@ -135,6 +135,7 @@ where
|
||||
Syntax::Typescript(TsConfig {
|
||||
tsx: fname.contains("tsx"),
|
||||
decorators: true,
|
||||
..Default::default()
|
||||
}),
|
||||
(&*fm).into(),
|
||||
None,
|
||||
|
@ -89,7 +89,7 @@ module.exports = {
|
||||
#[bench]
|
||||
fn module_clone(b: &mut Bencher) {
|
||||
let _ = ::testing::run_test(false, |cm, handler| {
|
||||
let fm = cm.new_source_file(FileName::Anon(0), SOURCE.into());
|
||||
let fm = cm.new_source_file(FileName::Anon, SOURCE.into());
|
||||
|
||||
let mut parser = Parser::new(
|
||||
Session { handler: &handler },
|
||||
@ -116,7 +116,7 @@ fn fold_empty(b: &mut Bencher) {
|
||||
|
||||
struct Noop;
|
||||
let _ = ::testing::run_test(false, |cm, handler| {
|
||||
let fm = cm.new_source_file(FileName::Anon(0), SOURCE.into());
|
||||
let fm = cm.new_source_file(FileName::Anon, SOURCE.into());
|
||||
|
||||
let mut parser = Parser::new(
|
||||
Session { handler: &handler },
|
||||
@ -154,7 +154,7 @@ fn fold_noop_impl_all(b: &mut Bencher) {
|
||||
b.bytes = SOURCE.len() as _;
|
||||
|
||||
let _ = ::testing::run_test(false, |cm, handler| {
|
||||
let fm = cm.new_source_file(FileName::Anon(0), SOURCE.into());
|
||||
let fm = cm.new_source_file(FileName::Anon, SOURCE.into());
|
||||
|
||||
let mut parser = Parser::new(
|
||||
Session { handler: &handler },
|
||||
@ -192,7 +192,7 @@ fn fold_noop_impl_vec(b: &mut Bencher) {
|
||||
b.bytes = SOURCE.len() as _;
|
||||
|
||||
let _ = ::testing::run_test(false, |cm, handler| {
|
||||
let fm = cm.new_source_file(FileName::Anon(0), SOURCE.into());
|
||||
let fm = cm.new_source_file(FileName::Anon, SOURCE.into());
|
||||
|
||||
let mut parser = Parser::new(
|
||||
Session { handler: &handler },
|
||||
@ -275,7 +275,7 @@ fn visit_empty(b: &mut Bencher) {
|
||||
|
||||
struct Noop;
|
||||
let _ = ::testing::run_test(false, |cm, handler| {
|
||||
let fm = cm.new_source_file(FileName::Anon(0), SOURCE.into());
|
||||
let fm = cm.new_source_file(FileName::Anon, SOURCE.into());
|
||||
|
||||
let mut parser = Parser::new(
|
||||
Session { handler: &handler },
|
||||
@ -328,7 +328,7 @@ fn visit_contains_this(b: &mut Bencher) {
|
||||
b.bytes = SOURCE.len() as _;
|
||||
|
||||
let _ = ::testing::run_test(false, |cm, handler| {
|
||||
let fm = cm.new_source_file(FileName::Anon(0), SOURCE.into());
|
||||
let fm = cm.new_source_file(FileName::Anon, SOURCE.into());
|
||||
|
||||
let mut parser = Parser::new(
|
||||
Session { handler: &handler },
|
||||
|
@ -94,7 +94,7 @@ macro_rules! tr {
|
||||
$b.bytes = SOURCE.len() as _;
|
||||
|
||||
let _ = ::testing::run_test(false, |cm, handler| {
|
||||
let fm = cm.new_source_file(FileName::Anon(0), SOURCE.into());
|
||||
let fm = cm.new_source_file(FileName::Anon, SOURCE.into());
|
||||
|
||||
let mut parser = Parser::new(
|
||||
Session { handler: &handler },
|
||||
|
Loading…
Reference in New Issue
Block a user