globset: compact Debug impl for GlobSetBuilder and Glob

Ideally we'd have a compact impl for `GlobSet` too, but that's a lot
more work. In particular, the constituent types don't all store the
original pattern string, so that would need to be added.

Closes #3026
This commit is contained in:
squidfunk
2025-04-09 21:24:17 +02:00
committed by Andrew Gallant
parent e83828fc8c
commit 6f39f830cb
2 changed files with 28 additions and 1 deletions

View File

@@ -1100,4 +1100,16 @@ mod tests {
let matches = set.matches("nada");
assert_eq!(0, matches.len());
}
#[test]
fn debug() {
let mut builder = GlobSetBuilder::new();
builder.add(Glob::new("*foo*").unwrap());
builder.add(Glob::new("*bar*").unwrap());
builder.add(Glob::new("*quux*").unwrap());
assert_eq!(
format!("{builder:?}"),
"GlobSetBuilder { pats: [Glob(\"*foo*\"), Glob(\"*bar*\"), Glob(\"*quux*\")] }",
);
}
}