aboutsummaryrefslogtreecommitdiff
path: root/xtask/tests
diff options
context:
space:
mode:
Diffstat (limited to 'xtask/tests')
-rw-r--r--xtask/tests/tidy-tests/cli.rs32
-rw-r--r--xtask/tests/tidy.rs (renamed from xtask/tests/tidy-tests/main.rs)41
2 files changed, 35 insertions, 38 deletions
diff --git a/xtask/tests/tidy-tests/cli.rs b/xtask/tests/tidy-tests/cli.rs
deleted file mode 100644
index f5b00a8b8..000000000
--- a/xtask/tests/tidy-tests/cli.rs
+++ /dev/null
@@ -1,32 +0,0 @@
1use xtask::{
2 codegen::{self, Mode},
3 run_rustfmt,
4};
5
6#[test]
7fn generated_grammar_is_fresh() {
8 if let Err(error) = codegen::generate_syntax(Mode::Verify) {
9 panic!("{}. Please update it by running `cargo xtask codegen`", error);
10 }
11}
12
13#[test]
14fn generated_tests_are_fresh() {
15 if let Err(error) = codegen::generate_parser_tests(Mode::Verify) {
16 panic!("{}. Please update tests by running `cargo xtask codegen`", error);
17 }
18}
19
20#[test]
21fn generated_assists_are_fresh() {
22 if let Err(error) = codegen::generate_assists_docs(Mode::Verify) {
23 panic!("{}. Please update assists by running `cargo xtask codegen`", error);
24 }
25}
26
27#[test]
28fn check_code_formatting() {
29 if let Err(error) = run_rustfmt(Mode::Verify) {
30 panic!("{}. Please format the code by running `cargo format`", error);
31 }
32}
diff --git a/xtask/tests/tidy-tests/main.rs b/xtask/tests/tidy.rs
index ead642acc..2e9fcf07c 100644
--- a/xtask/tests/tidy-tests/main.rs
+++ b/xtask/tests/tidy.rs
@@ -1,11 +1,41 @@
1mod cli;
2
3use std::{ 1use std::{
4 collections::HashMap, 2 collections::HashMap,
5 path::{Path, PathBuf}, 3 path::{Path, PathBuf},
6}; 4};
7 5
8use xtask::{not_bash::fs2, project_root, rust_files}; 6use xtask::{
7 codegen::{self, Mode},
8 not_bash::fs2,
9 project_root, run_rustfmt, rust_files,
10};
11
12#[test]
13fn generated_grammar_is_fresh() {
14 if let Err(error) = codegen::generate_syntax(Mode::Verify) {
15 panic!("{}. Please update it by running `cargo xtask codegen`", error);
16 }
17}
18
19#[test]
20fn generated_tests_are_fresh() {
21 if let Err(error) = codegen::generate_parser_tests(Mode::Verify) {
22 panic!("{}. Please update tests by running `cargo xtask codegen`", error);
23 }
24}
25
26#[test]
27fn generated_assists_are_fresh() {
28 if let Err(error) = codegen::generate_assists_docs(Mode::Verify) {
29 panic!("{}. Please update assists by running `cargo xtask codegen`", error);
30 }
31}
32
33#[test]
34fn check_code_formatting() {
35 if let Err(error) = run_rustfmt(Mode::Verify) {
36 panic!("{}. Please format the code by running `cargo format`", error);
37 }
38}
9 39
10#[test] 40#[test]
11fn rust_files_are_tidy() { 41fn rust_files_are_tidy() {
@@ -24,9 +54,10 @@ fn check_todo(path: &Path, text: &str) {
24 // This file itself is whitelisted since this test itself contains matches. 54 // This file itself is whitelisted since this test itself contains matches.
25 "tests/cli.rs", 55 "tests/cli.rs",
26 // Some of our assists generate `todo!()` so those files are whitelisted. 56 // Some of our assists generate `todo!()` so those files are whitelisted.
27 "doc_tests/generated.rs", 57 "tests/generated.rs",
28 "handlers/add_missing_impl_members.rs", 58 "handlers/add_missing_impl_members.rs",
29 "handlers/add_function.rs", 59 "handlers/add_function.rs",
60 "handlers/add_turbo_fish.rs",
30 // To support generating `todo!()` in assists, we have `expr_todo()` in ast::make. 61 // To support generating `todo!()` in assists, we have `expr_todo()` in ast::make.
31 "ast/make.rs", 62 "ast/make.rs",
32 ]; 63 ];
@@ -106,7 +137,6 @@ impl TidyDocs {
106 } 137 }
107 138
108 let whitelist = [ 139 let whitelist = [
109 "ra_db",
110 "ra_hir", 140 "ra_hir",
111 "ra_hir_expand", 141 "ra_hir_expand",
112 "ra_ide", 142 "ra_ide",
@@ -115,7 +145,6 @@ impl TidyDocs {
115 "ra_prof", 145 "ra_prof",
116 "ra_project_model", 146 "ra_project_model",
117 "ra_syntax", 147 "ra_syntax",
118 "ra_text_edit",
119 "ra_tt", 148 "ra_tt",
120 "ra_hir_ty", 149 "ra_hir_ty",
121 ]; 150 ];