From 845d47759ed59993b0c6c39f2f7237e96f4e8eaa Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 6 May 2020 10:25:25 +0200 Subject: [PATCH] Simplify tidy tests --- xtask/tests/tidy-tests/cli.rs | 32 ------------------ xtask/tests/{tidy-tests/main.rs => tidy.rs} | 36 +++++++++++++++++++-- 2 files changed, 33 insertions(+), 35 deletions(-) delete mode 100644 xtask/tests/tidy-tests/cli.rs rename xtask/tests/{tidy-tests/main.rs => tidy.rs} (82%) diff --git a/xtask/tests/tidy-tests/cli.rs b/xtask/tests/tidy-tests/cli.rs deleted file mode 100644 index f5b00a8b8c..0000000000 --- a/xtask/tests/tidy-tests/cli.rs +++ /dev/null @@ -1,32 +0,0 @@ -use xtask::{ - codegen::{self, Mode}, - run_rustfmt, -}; - -#[test] -fn generated_grammar_is_fresh() { - if let Err(error) = codegen::generate_syntax(Mode::Verify) { - panic!("{}. Please update it by running `cargo xtask codegen`", error); - } -} - -#[test] -fn generated_tests_are_fresh() { - if let Err(error) = codegen::generate_parser_tests(Mode::Verify) { - panic!("{}. Please update tests by running `cargo xtask codegen`", error); - } -} - -#[test] -fn generated_assists_are_fresh() { - if let Err(error) = codegen::generate_assists_docs(Mode::Verify) { - panic!("{}. Please update assists by running `cargo xtask codegen`", error); - } -} - -#[test] -fn check_code_formatting() { - if let Err(error) = run_rustfmt(Mode::Verify) { - panic!("{}. Please format the code by running `cargo format`", error); - } -} diff --git a/xtask/tests/tidy-tests/main.rs b/xtask/tests/tidy.rs similarity index 82% rename from xtask/tests/tidy-tests/main.rs rename to xtask/tests/tidy.rs index a3c2e37d1d..c4eac1bc4e 100644 --- a/xtask/tests/tidy-tests/main.rs +++ b/xtask/tests/tidy.rs @@ -1,11 +1,41 @@ -mod cli; - use std::{ collections::HashMap, path::{Path, PathBuf}, }; -use xtask::{not_bash::fs2, project_root, rust_files}; +use xtask::{ + codegen::{self, Mode}, + not_bash::fs2, + project_root, run_rustfmt, rust_files, +}; + +#[test] +fn generated_grammar_is_fresh() { + if let Err(error) = codegen::generate_syntax(Mode::Verify) { + panic!("{}. Please update it by running `cargo xtask codegen`", error); + } +} + +#[test] +fn generated_tests_are_fresh() { + if let Err(error) = codegen::generate_parser_tests(Mode::Verify) { + panic!("{}. Please update tests by running `cargo xtask codegen`", error); + } +} + +#[test] +fn generated_assists_are_fresh() { + if let Err(error) = codegen::generate_assists_docs(Mode::Verify) { + panic!("{}. Please update assists by running `cargo xtask codegen`", error); + } +} + +#[test] +fn check_code_formatting() { + if let Err(error) = run_rustfmt(Mode::Verify) { + panic!("{}. Please format the code by running `cargo format`", error); + } +} #[test] fn rust_files_are_tidy() {