Skip to content

Commit 48b4621

Browse files
authored
Merge branch 'main' into fix/239
2 parents 9b60373 + be4f18f commit 48b4621

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

crates/core/src/repofile/snapshotfile.rs

+15-7
Original file line numberDiff line numberDiff line change
@@ -1193,13 +1193,11 @@ pub struct PathList(Vec<PathBuf>);
11931193

11941194
impl Display for PathList {
11951195
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1196-
if !self.0.is_empty() {
1197-
write!(f, "{:?}", self.0[0])?;
1198-
}
1199-
for p in &self.0[1..] {
1200-
write!(f, ",{p:?}")?;
1201-
}
1202-
Ok(())
1196+
self.0
1197+
.iter()
1198+
.map(|p| p.to_string_lossy())
1199+
.format(",")
1200+
.fmt(f)
12031201
}
12041202
}
12051203

@@ -1368,4 +1366,14 @@ mod tests {
13681366
assert_eq!(crit.paths, is_path);
13691367
assert_eq!(crit.tags, is_tags);
13701368
}
1369+
1370+
#[rstest]
1371+
#[case(vec![], "")]
1372+
#[case(vec!["test"], "test")]
1373+
#[case(vec!["test", "test", "test"], "test,test,test")]
1374+
fn test_display_path_list_passes(#[case] input: Vec<&str>, #[case] expected: &str) {
1375+
let path_list = PathList::from_iter(input);
1376+
let result = path_list.to_string();
1377+
assert_eq!(expected, &result);
1378+
}
13711379
}

0 commit comments

Comments
 (0)