diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-06-10 23:49:51 +0100 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-06-10 23:49:51 +0100 |
commit | 3f5f9f0560fa662e770b607f05ec4881e4d011c5 (patch) | |
tree | 0f9009e016d326a6df81bec95a03281db3bf7d07 /crates/ra_tools/tests | |
parent | 1c867b4e67126350579d6d598efeb6c03b503ddc (diff) | |
parent | 10d34532e3e96ffd92c11e667deb453188c28282 (diff) |
Merge #1391
1391: rename tools -> ra_tools r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_tools/tests')
-rw-r--r-- | crates/ra_tools/tests/cli.rs | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/crates/ra_tools/tests/cli.rs b/crates/ra_tools/tests/cli.rs new file mode 100644 index 000000000..83640218f --- /dev/null +++ b/crates/ra_tools/tests/cli.rs | |||
@@ -0,0 +1,46 @@ | |||
1 | use walkdir::WalkDir; | ||
2 | |||
3 | use ra_tools::{generate, gen_tests, run_rustfmt, Verify, project_root}; | ||
4 | |||
5 | #[test] | ||
6 | fn generated_grammar_is_fresh() { | ||
7 | if let Err(error) = generate(Verify) { | ||
8 | panic!("{}. Please update it by running `cargo gen-syntax`", error); | ||
9 | } | ||
10 | } | ||
11 | |||
12 | #[test] | ||
13 | fn generated_tests_are_fresh() { | ||
14 | if let Err(error) = gen_tests(Verify) { | ||
15 | panic!("{}. Please update tests by running `cargo gen-tests`", error); | ||
16 | } | ||
17 | } | ||
18 | |||
19 | #[test] | ||
20 | fn check_code_formatting() { | ||
21 | if let Err(error) = run_rustfmt(Verify) { | ||
22 | panic!("{}. Please format the code by running `cargo format`", error); | ||
23 | } | ||
24 | } | ||
25 | |||
26 | #[test] | ||
27 | fn no_todo() { | ||
28 | WalkDir::new(project_root().join("crates")).into_iter().for_each(|e| { | ||
29 | let e = e.unwrap(); | ||
30 | if e.path().extension().map(|it| it != "rs").unwrap_or(true) { | ||
31 | return; | ||
32 | } | ||
33 | if e.path().ends_with("tests/cli.rs") { | ||
34 | return; | ||
35 | } | ||
36 | let text = std::fs::read_to_string(e.path()).unwrap(); | ||
37 | if text.contains("TODO") { | ||
38 | panic!( | ||
39 | "\nTODO markers should not be commited to the master branch,\n\ | ||
40 | use FIXME instead\n\ | ||
41 | {}\n", | ||
42 | e.path().display(), | ||
43 | ) | ||
44 | } | ||
45 | }) | ||
46 | } | ||