aboutsummaryrefslogtreecommitdiff
path: root/crates/tools/tests/cli.rs
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-03-23 08:07:30 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-03-23 08:07:30 +0000
commit3d7a330f320ac2ebf73df012556d64be9b120445 (patch)
treeb96c4a3c4f1165fd394ce3a854dbe9e02d370a92 /crates/tools/tests/cli.rs
parent15189bc7249fc68a1df0234721514b677a90a305 (diff)
parent4fd8cfd6adc554752a63aed9ed71d44b372ec4dc (diff)
Merge #990
990: Forbid TODO markers on master branch r=matklad a=matklad this makes TODO markers useful for things which you want to fix before sending a PR Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/tools/tests/cli.rs')
-rw-r--r--crates/tools/tests/cli.rs26
1 files changed, 25 insertions, 1 deletions
diff --git a/crates/tools/tests/cli.rs b/crates/tools/tests/cli.rs
index aab52a4aa..6f82ae61d 100644
--- a/crates/tools/tests/cli.rs
+++ b/crates/tools/tests/cli.rs
@@ -1,4 +1,6 @@
1use tools::{generate, gen_tests, run_rustfmt, Verify}; 1use walkdir::WalkDir;
2
3use tools::{generate, gen_tests, run_rustfmt, Verify, project_root};
2 4
3#[test] 5#[test]
4fn generated_grammar_is_fresh() { 6fn generated_grammar_is_fresh() {
@@ -20,3 +22,25 @@ fn check_code_formatting() {
20 panic!("{}. Please format the code by running `cargo format`", error); 22 panic!("{}. Please format the code by running `cargo format`", error);
21 } 23 }
22} 24}
25
26#[test]
27fn 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}