diff --git a/Cargo.lock b/Cargo.lock index e0aac061d1..a90acab9cc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -421,6 +421,25 @@ dependencies = [ "crypto-common", ] +[[package]] +name = "dir-test" +version = "0.1.0" +source = "git+https://github.com/fe-lang/dir-test#3a3a3f331005ba9c28db35aef3815e2de47ff9b9" +dependencies = [ + "dir-test-macros", +] + +[[package]] +name = "dir-test-macros" +version = "0.1.0" +source = "git+https://github.com/fe-lang/dir-test#3a3a3f331005ba9c28db35aef3815e2de47ff9b9" +dependencies = [ + "glob", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "dot2" version = "0.1.0" @@ -750,11 +769,14 @@ dependencies = [ name = "fe-parser2" version = "0.20.0-alpha" dependencies = [ + "dir-test", "fe-compiler-test-utils", "fxhash", "lazy_static", "logos", "rowan", + "wasm-bindgen", + "wasm-bindgen-test", ] [[package]] @@ -862,6 +884,12 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "glob" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" + [[package]] name = "half" version = "1.8.2" diff --git a/crates/parser2/Cargo.toml b/crates/parser2/Cargo.toml index 42c872ba2d..42e7982c66 100644 --- a/crates/parser2/Cargo.toml +++ b/crates/parser2/Cargo.toml @@ -16,4 +16,9 @@ fxhash = "0.2.1" lazy_static = "1.4.0" [dev-dependencies] -fe-compiler-test-utils = { path = "../test-utils" } \ No newline at end of file +fe-compiler-test-utils = { path = "../test-utils" } +dir-test = { git = "https://github.com/fe-lang/dir-test" } +wasm-bindgen-test = "0.3" + +[target.'cfg(target_arch = "wasm32")'.dependencies] +wasm-bindgen = "0.2" \ No newline at end of file diff --git a/crates/parser2/tests/syntax_node.rs b/crates/parser2/tests/syntax_node.rs index 8c645760b5..46774d8b4d 100644 --- a/crates/parser2/tests/syntax_node.rs +++ b/crates/parser2/tests/syntax_node.rs @@ -5,6 +5,7 @@ use fe_parser2::{ mod test_runner; use test_runner::*; +use wasm_bindgen_test::wasm_bindgen_test; fe_compiler_test_utils::build_debug_snap_tests! { "parser2/test_files/syntax_node/structs", @@ -87,3 +88,13 @@ fe_compiler_test_utils::build_debug_snap_tests!( "parser2/test_files/syntax_node/items", test_item_list ); + +#[dir_test::dir_test( + #[wasm_bindgen_test] + dir: "$CARGO_MANIFEST_DIR/test_files/syntax_node", + glob: "**/*.fe" + postfix: "wasm" +)] +fn ident(fixture: dir_test::Fixture) { + assert!(fixture.content() == fixture.content()); +}