react/compiler/crates/react_hermes_parser/tests/parser_test.rs
Joe Savona f33e63838d Update copyrights to reference Meta instead of Facebook
Thanks @zpao!!! This was mostly his work, i just fixed up the last bit.
2024-04-03 08:43:36 -07:00

27 lines
856 B
Rust

/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
use std::env;
use insta::{assert_snapshot, glob};
use react_estree::SourceType;
use react_hermes_parser::parse;
#[test]
fn fixtures() {
glob!("fixtures/**.js", |path| {
println!("fixture {}", path.to_str().unwrap());
let input = std::fs::read_to_string(path).unwrap();
let mut ast = parse(&input, path.to_str().unwrap()).unwrap();
// TODO: hack to prevent changing lots of fixtures all at once
ast.source_type = SourceType::Script;
let output = serde_json::to_string_pretty(&ast).unwrap();
let output = output.trim();
assert_snapshot!(format!("Input:\n{input}\n\nOutput:\n{output}"));
});
}