about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAleksey Kladov <aleksey.kladov@gmail.com>2019-10-23 18:17:24 +0300
committerAleksey Kladov <aleksey.kladov@gmail.com>2019-10-23 18:57:18 +0300
commita669049ef327db5be04f076eff83932ac1f95d91 (patch)
treeecc21b23217780ef7ca9279694170f4359b50150
parentb5f13d8d51ef9107363a60b894a741ab596921ce (diff)
downloadrust-a669049ef327db5be04f076eff83932ac1f95d91.tar.gz
rust-a669049ef327db5be04f076eff83932ac1f95d91.zip
xtask: fold gen-tests and gen-ast into codegen
-rw-r--r--docs/dev/architecture.md2
-rw-r--r--xtask/src/help.rs1
-rw-r--r--xtask/src/main.rs10
-rw-r--r--xtask/tests/tidy-tests/cli.rs2
4 files changed, 4 insertions, 11 deletions
diff --git a/docs/dev/architecture.md b/docs/dev/architecture.md
index 5ec5352e713..6fd396dee6e 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 4c6bf6b53c9..730eb5c615e 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 0b19c34f434..db901ced263 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 304d77d891c..543c7d7c453 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);
     }
 }