sort issue tags

This will be useful testing (and general consistency) when tags are
files in a directory instead of lines in a file, and thus subject to
random directory order.
This commit is contained in:
Sebastian Kuzminsky 2025-07-23 18:45:20 -06:00
parent e1287514f6
commit 7abcf2e446
2 changed files with 4 additions and 3 deletions

View file

@ -143,6 +143,7 @@ impl Issue {
.filter(|s| s.len() > 0) .filter(|s| s.len() > 0)
.map(|tag| String::from(tag.trim())) .map(|tag| String::from(tag.trim()))
.collect(); .collect();
tags.sort();
} else if file_name == "comments" && direntry.metadata()?.is_dir() { } else if file_name == "comments" && direntry.metadata()?.is_dir() {
Self::read_comments(&mut comments, &direntry.path())?; Self::read_comments(&mut comments, &direntry.path())?;
} else { } else {
@ -562,9 +563,9 @@ mod tests {
.with_timezone(&chrono::Local), .with_timezone(&chrono::Local),
done_time: None, done_time: None,
tags: Vec::<String>::from([ tags: Vec::<String>::from([
String::from("tag1"),
String::from("TAG2"), String::from("TAG2"),
String::from("i-am-also-a-tag"), String::from("i-am-also-a-tag"),
String::from("tag1"),
]), ]),
state: State::New, state: State::New,
dependencies: None, dependencies: None,

View file

@ -127,9 +127,9 @@ mod tests {
.with_timezone(&chrono::Local), .with_timezone(&chrono::Local),
done_time: None, done_time: None,
tags: Vec::<String>::from([ tags: Vec::<String>::from([
String::from("tag1"),
String::from("TAG2"), String::from("TAG2"),
String::from("i-am-also-a-tag") String::from("i-am-also-a-tag"),
String::from("tag1"),
]), ]),
state: crate::issue::State::New, state: crate::issue::State::New,
dependencies: None, dependencies: None,