mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-12 21:28:51 +00:00
xtask: fold gen-tests and gen-ast into codegen
This commit is contained in:
parent
b5f13d8d51
commit
a669049ef3
4 changed files with 4 additions and 11 deletions
|
@ -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
|
||||
|
|
|
@ -13,7 +13,6 @@ SUBCOMMANDS:
|
|||
format-hook
|
||||
fuzz-tests
|
||||
codegen
|
||||
gen-tests
|
||||
install
|
||||
lint";
|
||||
|
||||
|
|
|
@ -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"]) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue