diff --git a/crates/tools/tests/cli.rs b/crates/tools/tests/cli.rs index aab52a4aaa6..6f82ae61d97 100644 --- a/crates/tools/tests/cli.rs +++ b/crates/tools/tests/cli.rs @@ -1,4 +1,6 @@ -use tools::{generate, gen_tests, run_rustfmt, Verify}; +use walkdir::WalkDir; + +use tools::{generate, gen_tests, run_rustfmt, Verify, project_root}; #[test] fn generated_grammar_is_fresh() { @@ -20,3 +22,25 @@ fn check_code_formatting() { 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(), + ) + } + }) +}