From a669049ef327db5be04f076eff83932ac1f95d91 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 23 Oct 2019 18:17:24 +0300 Subject: [PATCH] xtask: fold gen-tests and gen-ast into codegen --- docs/dev/architecture.md | 2 +- xtask/src/help.rs | 1 - xtask/src/main.rs | 10 ++-------- xtask/tests/tidy-tests/cli.rs | 2 +- 4 files changed, 4 insertions(+), 11 deletions(-) diff --git a/docs/dev/architecture.md b/docs/dev/architecture.md index 5ec5352e71..6fd396dee6 100644 --- a/docs/dev/architecture.md +++ b/docs/dev/architecture.md @@ -78,7 +78,7 @@ Rust syntax tree structure and parser. See Tests for ra_syntax are mostly data-driven: `test_data/parser` contains subdirectories with a bunch of `.rs` (test vectors) and `.txt` files with corresponding syntax trees. During testing, we check `.rs` against `.txt`. If the `.txt` file is missing, it is created (this is how you update -tests). Additionally, running `cargo gen-tests` will walk the grammar module and collect +tests). Additionally, running `cargo xtask codegen` will walk the grammar module and collect all `// test test_name` comments into files inside `test_data/parser/inline` directory. See [#93](https://github.com/rust-analyzer/rust-analyzer/pull/93) for an example PR which diff --git a/xtask/src/help.rs b/xtask/src/help.rs index 4c6bf6b53c..730eb5c615 100644 --- a/xtask/src/help.rs +++ b/xtask/src/help.rs @@ -13,7 +13,6 @@ SUBCOMMANDS: format-hook fuzz-tests codegen - gen-tests install lint"; diff --git a/xtask/src/main.rs b/xtask/src/main.rs index 0b19c34f43..db901ced26 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -57,19 +57,13 @@ fn main() -> Result<()> { }; install(opts)? } - "gen-tests" => { - if matches.contains(["-h", "--help"]) { - help::print_no_param_subcommand_help(&subcommand); - return Ok(()); - } - codegen::generate_parser_tests(Mode::Overwrite)? - } "codegen" => { if matches.contains(["-h", "--help"]) { help::print_no_param_subcommand_help(&subcommand); return Ok(()); } - codegen::generate_syntax(Mode::Overwrite)? + codegen::generate_syntax(Mode::Overwrite)?; + codegen::generate_parser_tests(Mode::Overwrite)?; } "format" => { if matches.contains(["-h", "--help"]) { diff --git a/xtask/tests/tidy-tests/cli.rs b/xtask/tests/tidy-tests/cli.rs index 304d77d891..543c7d7c45 100644 --- a/xtask/tests/tidy-tests/cli.rs +++ b/xtask/tests/tidy-tests/cli.rs @@ -14,7 +14,7 @@ fn generated_grammar_is_fresh() { #[test] fn generated_tests_are_fresh() { if let Err(error) = codegen::generate_parser_tests(Mode::Verify) { - panic!("{}. Please update tests by running `cargo xtask gen-tests`", error); + panic!("{}. Please update tests by running `cargo xtask codegen`", error); } }