tests: don't sort so test tags are ordered nicely

This commit is contained in:
Graham Christensen 2019-01-29 21:42:19 -05:00
parent d35a5c9b0a
commit d0bc3b0671
No known key found for this signature in database
GPG key ID: ACA1C1D120C83D5C

View file

@ -119,20 +119,19 @@ impl Default for RebuildTagger {
fn default() -> RebuildTagger { fn default() -> RebuildTagger {
let mut t = RebuildTagger { let mut t = RebuildTagger {
possible: vec![ possible: vec![
String::from("10.rebuild-linux: 501+"),
String::from("10.rebuild-linux: 101-500"),
String::from("10.rebuild-linux: 11-100"),
String::from("10.rebuild-linux: 1-10"),
String::from("10.rebuild-linux: 0"),
String::from("10.rebuild-darwin: 501+"),
String::from("10.rebuild-darwin: 101-500"),
String::from("10.rebuild-darwin: 11-100"),
String::from("10.rebuild-darwin: 1-10"),
String::from("10.rebuild-darwin: 0"), String::from("10.rebuild-darwin: 0"),
String::from("10.rebuild-darwin: 1-10"),
String::from("10.rebuild-darwin: 11-100"),
String::from("10.rebuild-darwin: 101-500"),
String::from("10.rebuild-darwin: 501+"),
String::from("10.rebuild-linux: 0"),
String::from("10.rebuild-linux: 1-10"),
String::from("10.rebuild-linux: 11-100"),
String::from("10.rebuild-linux: 101-500"),
String::from("10.rebuild-linux: 501+"),
], ],
selected: vec![], selected: vec![],
}; };
t.possible.sort();
t t
} }
@ -183,13 +182,13 @@ impl RebuildTagger {
} }
pub fn tags_to_remove(&self) -> Vec<String> { pub fn tags_to_remove(&self) -> Vec<String> {
let mut remove = self.possible.clone(); let mut remove = vec![];
for tag in &self.selected {
let pos = remove.binary_search(&tag).unwrap();
remove.remove(pos);
}
remove.sort(); for tag in self.possible.clone().into_iter() {
if !self.selected.contains(&tag) {
remove.push(tag);
}
}
remove remove
} }
@ -369,13 +368,13 @@ mod tests {
tagger.tags_to_remove(), tagger.tags_to_remove(),
vec![ vec![
"10.rebuild-darwin: 1-10", "10.rebuild-darwin: 1-10",
"10.rebuild-darwin: 101-500",
"10.rebuild-darwin: 11-100", "10.rebuild-darwin: 11-100",
"10.rebuild-darwin: 101-500",
"10.rebuild-darwin: 501+", "10.rebuild-darwin: 501+",
"10.rebuild-linux: 1-10", "10.rebuild-linux: 1-10",
"10.rebuild-linux: 101-500",
"10.rebuild-linux: 11-100", "10.rebuild-linux: 11-100",
"10.rebuild-linux: 501+" "10.rebuild-linux: 101-500",
"10.rebuild-linux: 501+",
] ]
); );
@ -390,13 +389,13 @@ mod tests {
tagger.tags_to_remove(), tagger.tags_to_remove(),
vec![ vec![
"10.rebuild-darwin: 1-10", "10.rebuild-darwin: 1-10",
"10.rebuild-darwin: 101-500",
"10.rebuild-darwin: 11-100", "10.rebuild-darwin: 11-100",
"10.rebuild-darwin: 101-500",
"10.rebuild-darwin: 501+", "10.rebuild-darwin: 501+",
"10.rebuild-linux: 0", "10.rebuild-linux: 0",
"10.rebuild-linux: 101-500",
"10.rebuild-linux: 11-100", "10.rebuild-linux: 11-100",
"10.rebuild-linux: 501+" "10.rebuild-linux: 101-500",
"10.rebuild-linux: 501+",
] ]
); );
@ -410,13 +409,13 @@ mod tests {
tagger.tags_to_remove(), tagger.tags_to_remove(),
vec![ vec![
"10.rebuild-darwin: 0", "10.rebuild-darwin: 0",
"10.rebuild-darwin: 101-500",
"10.rebuild-darwin: 11-100", "10.rebuild-darwin: 11-100",
"10.rebuild-darwin: 101-500",
"10.rebuild-darwin: 501+", "10.rebuild-darwin: 501+",
"10.rebuild-linux: 0", "10.rebuild-linux: 0",
"10.rebuild-linux: 101-500",
"10.rebuild-linux: 11-100", "10.rebuild-linux: 11-100",
"10.rebuild-linux: 501+" "10.rebuild-linux: 101-500",
"10.rebuild-linux: 501+",
] ]
); );
@ -430,13 +429,13 @@ mod tests {
tagger.tags_to_remove(), tagger.tags_to_remove(),
vec![ vec![
"10.rebuild-darwin: 0", "10.rebuild-darwin: 0",
"10.rebuild-darwin: 101-500",
"10.rebuild-darwin: 11-100", "10.rebuild-darwin: 11-100",
"10.rebuild-darwin: 101-500",
"10.rebuild-darwin: 501+", "10.rebuild-darwin: 501+",
"10.rebuild-linux: 0", "10.rebuild-linux: 0",
"10.rebuild-linux: 101-500",
"10.rebuild-linux: 11-100", "10.rebuild-linux: 11-100",
"10.rebuild-linux: 501+" "10.rebuild-linux: 101-500",
"10.rebuild-linux: 501+",
] ]
); );
@ -456,7 +455,7 @@ mod tests {
"10.rebuild-linux: 0", "10.rebuild-linux: 0",
"10.rebuild-linux: 1-10", "10.rebuild-linux: 1-10",
"10.rebuild-linux: 101-500", "10.rebuild-linux: 101-500",
"10.rebuild-linux: 501+" "10.rebuild-linux: 501+",
] ]
); );
@ -476,7 +475,7 @@ mod tests {
"10.rebuild-linux: 0", "10.rebuild-linux: 0",
"10.rebuild-linux: 1-10", "10.rebuild-linux: 1-10",
"10.rebuild-linux: 101-500", "10.rebuild-linux: 101-500",
"10.rebuild-linux: 501+" "10.rebuild-linux: 501+",
] ]
); );
@ -496,7 +495,7 @@ mod tests {
"10.rebuild-linux: 0", "10.rebuild-linux: 0",
"10.rebuild-linux: 1-10", "10.rebuild-linux: 1-10",
"10.rebuild-linux: 11-100", "10.rebuild-linux: 11-100",
"10.rebuild-linux: 501+" "10.rebuild-linux: 501+",
] ]
); );
@ -516,7 +515,7 @@ mod tests {
"10.rebuild-linux: 0", "10.rebuild-linux: 0",
"10.rebuild-linux: 1-10", "10.rebuild-linux: 1-10",
"10.rebuild-linux: 11-100", "10.rebuild-linux: 11-100",
"10.rebuild-linux: 501+" "10.rebuild-linux: 501+",
] ]
); );