From 862a7407234cb70245f8ab52d32ce9823b067e93 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Wed, 29 May 2024 15:05:54 -0500 Subject: [PATCH] fix(filter): Allow underscore in placeholders --- crates/snapbox/src/filter/redactions.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/snapbox/src/filter/redactions.rs b/crates/snapbox/src/filter/redactions.rs index 03f35793..e0f9227b 100644 --- a/crates/snapbox/src/filter/redactions.rs +++ b/crates/snapbox/src/filter/redactions.rs @@ -331,7 +331,7 @@ fn validate_placeholder(placeholder: &'static str) -> crate::assert::Result<&'st } if placeholder[1..(placeholder.len() - 1)] - .find(|c: char| !c.is_ascii_uppercase()) + .find(|c: char| !c.is_ascii_uppercase() && c != '_') .is_some() { return Err(format!("Key `{}` can only be A-Z but ", placeholder).into()); @@ -350,6 +350,7 @@ mod test { ("[HELLO", false), ("HELLO]", false), ("[HELLO]", true), + ("[HELLO_WORLD]", true), ("[hello]", false), ("[HE O]", false), ];