Add cargo file tidy test
This commit is contained in:
parent
85e1f0905a
commit
e73ffbf1e5
3 changed files with 50 additions and 14 deletions
|
|
@ -5,6 +5,7 @@ use std::{
|
|||
|
||||
use xshell::{cmd, read_file};
|
||||
use xtask::{
|
||||
cargo_files,
|
||||
codegen::{self, Mode},
|
||||
project_root, run_rustfmt, rust_files,
|
||||
};
|
||||
|
|
@ -93,6 +94,32 @@ fn rust_files_are_tidy() {
|
|||
tidy_docs.finish();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cargo_files_are_tidy() {
|
||||
for cargo in cargo_files() {
|
||||
let mut section = None;
|
||||
for (line_no, text) in read_file(&cargo).unwrap().lines().enumerate() {
|
||||
let text = text.trim();
|
||||
if text.starts_with("[") {
|
||||
section = Some(text);
|
||||
continue;
|
||||
}
|
||||
if !section.map(|it| it.starts_with("[dependencies")).unwrap_or(false) {
|
||||
continue;
|
||||
}
|
||||
let text: String = text.split_whitespace().collect();
|
||||
if text.contains("path=") && !text.contains("version") {
|
||||
panic!(
|
||||
"\ncargo internal dependencies should have version.\n\
|
||||
{}:{}\n",
|
||||
cargo.display(),
|
||||
line_no + 1
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn check_merge_commits() {
|
||||
let stdout = cmd!("git rev-list --merges --invert-grep --author 'bors\\[bot\\]' HEAD~19..")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue