diff options
author | Mikhail Rakhmanov <[email protected]> | 2020-06-03 19:10:54 +0100 |
---|---|---|
committer | Mikhail Rakhmanov <[email protected]> | 2020-06-03 19:10:54 +0100 |
commit | eefa10bc6bff3624ddd0bbb6bc89d8beb4bed186 (patch) | |
tree | 15c38c2993c52f4065d338090ca9185cc1fcd3da /xtask/tests | |
parent | a9d567584857b1be4ca8eaa5ef2c7d85f7b2845e (diff) | |
parent | 794f6da821c5d6e2490b996baffe162e4753262d (diff) |
Merge branch 'master' into assists_extract_enum
Diffstat (limited to 'xtask/tests')
-rw-r--r-- | xtask/tests/tidy.rs | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/xtask/tests/tidy.rs b/xtask/tests/tidy.rs index 2e9fcf07c..d38ac7f17 100644 --- a/xtask/tests/tidy.rs +++ b/xtask/tests/tidy.rs | |||
@@ -25,7 +25,7 @@ fn generated_tests_are_fresh() { | |||
25 | 25 | ||
26 | #[test] | 26 | #[test] |
27 | fn generated_assists_are_fresh() { | 27 | fn generated_assists_are_fresh() { |
28 | if let Err(error) = codegen::generate_assists_docs(Mode::Verify) { | 28 | if let Err(error) = codegen::generate_assists_tests(Mode::Verify) { |
29 | panic!("{}. Please update assists by running `cargo xtask codegen`", error); | 29 | panic!("{}. Please update assists by running `cargo xtask codegen`", error); |
30 | } | 30 | } |
31 | } | 31 | } |
@@ -95,7 +95,7 @@ impl TidyDocs { | |||
95 | fn visit(&mut self, path: &Path, text: &str) { | 95 | fn visit(&mut self, path: &Path, text: &str) { |
96 | // Test hopefully don't really need comments, and for assists we already | 96 | // Test hopefully don't really need comments, and for assists we already |
97 | // have special comments which are source of doc tests and user docs. | 97 | // have special comments which are source of doc tests and user docs. |
98 | if is_exclude_dir(path, &["tests", "test_data", "handlers"]) { | 98 | if is_exclude_dir(path, &["tests", "test_data"]) { |
99 | return; | 99 | return; |
100 | } | 100 | } |
101 | 101 | ||
@@ -110,9 +110,12 @@ impl TidyDocs { | |||
110 | 110 | ||
111 | if first_line.starts_with("//!") { | 111 | if first_line.starts_with("//!") { |
112 | if first_line.contains("FIXME") { | 112 | if first_line.contains("FIXME") { |
113 | self.contains_fixme.push(path.to_path_buf()) | 113 | self.contains_fixme.push(path.to_path_buf()); |
114 | } | 114 | } |
115 | } else { | 115 | } else { |
116 | if text.contains("// Feature:") || text.contains("// Assist:") { | ||
117 | return; | ||
118 | } | ||
116 | self.missing_docs.push(path.display().to_string()); | 119 | self.missing_docs.push(path.display().to_string()); |
117 | } | 120 | } |
118 | 121 | ||
@@ -170,13 +173,11 @@ impl TidyDocs { | |||
170 | } | 173 | } |
171 | 174 | ||
172 | fn is_exclude_dir(p: &Path, dirs_to_exclude: &[&str]) -> bool { | 175 | fn is_exclude_dir(p: &Path, dirs_to_exclude: &[&str]) -> bool { |
173 | let mut cur_path = p; | 176 | p.strip_prefix(project_root()) |
174 | while let Some(path) = cur_path.parent() { | 177 | .unwrap() |
175 | if dirs_to_exclude.iter().any(|dir| path.ends_with(dir)) { | 178 | .components() |
176 | return true; | 179 | .rev() |
177 | } | 180 | .skip(1) |
178 | cur_path = path; | 181 | .filter_map(|it| it.as_os_str().to_str()) |
179 | } | 182 | .any(|it| dirs_to_exclude.contains(&it)) |
180 | |||
181 | false | ||
182 | } | 183 | } |