aboutsummaryrefslogtreecommitdiff
path: root/xtask/tests
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-02-03 14:02:30 +0000
committerGitHub <[email protected]>2021-02-03 14:02:30 +0000
commit93ecef53a370703a67f87b90c4640d3e8bf73934 (patch)
tree48f6079b55d32e13f355443aa82a5278a9c68a23 /xtask/tests
parent85e1f0905aae762b8d64b52e76bbc6aa5915894b (diff)
parente73ffbf1e59eb05fe8ffe73ce4e1833295c588a5 (diff)
Merge #7539
7539: Add cargo file tidy test r=edwin0cheng a=edwin0cheng bors r+ cc @pksunkara Co-authored-by: Edwin Cheng <[email protected]>
Diffstat (limited to 'xtask/tests')
-rw-r--r--xtask/tests/tidy.rs27
1 files changed, 27 insertions, 0 deletions
diff --git a/xtask/tests/tidy.rs b/xtask/tests/tidy.rs
index 9a6933b09..cb83e07fd 100644
--- a/xtask/tests/tidy.rs
+++ b/xtask/tests/tidy.rs
@@ -5,6 +5,7 @@ use std::{
5 5
6use xshell::{cmd, read_file}; 6use xshell::{cmd, read_file};
7use xtask::{ 7use xtask::{
8 cargo_files,
8 codegen::{self, Mode}, 9 codegen::{self, Mode},
9 project_root, run_rustfmt, rust_files, 10 project_root, run_rustfmt, rust_files,
10}; 11};
@@ -94,6 +95,32 @@ fn rust_files_are_tidy() {
94} 95}
95 96
96#[test] 97#[test]
98fn cargo_files_are_tidy() {
99 for cargo in cargo_files() {
100 let mut section = None;
101 for (line_no, text) in read_file(&cargo).unwrap().lines().enumerate() {
102 let text = text.trim();
103 if text.starts_with("[") {
104 section = Some(text);
105 continue;
106 }
107 if !section.map(|it| it.starts_with("[dependencies")).unwrap_or(false) {
108 continue;
109 }
110 let text: String = text.split_whitespace().collect();
111 if text.contains("path=") && !text.contains("version") {
112 panic!(
113 "\ncargo internal dependencies should have version.\n\
114 {}:{}\n",
115 cargo.display(),
116 line_no + 1
117 )
118 }
119 }
120 }
121}
122
123#[test]
97fn check_merge_commits() { 124fn check_merge_commits() {
98 let stdout = cmd!("git rev-list --merges --invert-grep --author 'bors\\[bot\\]' HEAD~19..") 125 let stdout = cmd!("git rev-list --merges --invert-grep --author 'bors\\[bot\\]' HEAD~19..")
99 .read() 126 .read()