From 10d34532e3e96ffd92c11e667deb453188c28282 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 11 Jun 2019 01:47:37 +0300 Subject: rename tools -> ra_tools This should help with caching on CI I hope (see .travis.yml before_cache) --- crates/ra_tools/tests/cli.rs | 46 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 crates/ra_tools/tests/cli.rs (limited to 'crates/ra_tools/tests') 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 @@ +use walkdir::WalkDir; + +use ra_tools::{generate, gen_tests, run_rustfmt, Verify, project_root}; + +#[test] +fn generated_grammar_is_fresh() { + if let Err(error) = generate(Verify) { + panic!("{}. Please update it by running `cargo gen-syntax`", error); + } +} + +#[test] +fn generated_tests_are_fresh() { + if let Err(error) = gen_tests(Verify) { + panic!("{}. Please update tests by running `cargo gen-tests`", error); + } +} + +#[test] +fn check_code_formatting() { + if let Err(error) = run_rustfmt(Verify) { + panic!("{}. Please format the code by running `cargo format`", error); + } +} + +#[test] +fn no_todo() { + WalkDir::new(project_root().join("crates")).into_iter().for_each(|e| { + let e = e.unwrap(); + if e.path().extension().map(|it| it != "rs").unwrap_or(true) { + return; + } + if e.path().ends_with("tests/cli.rs") { + return; + } + let text = std::fs::read_to_string(e.path()).unwrap(); + if text.contains("TODO") { + panic!( + "\nTODO markers should not be commited to the master branch,\n\ + use FIXME instead\n\ + {}\n", + e.path().display(), + ) + } + }) +} -- cgit v1.2.3