Refactor JSON tests (#2484)

This commit is contained in:
Casey Rodarmor 2024-11-27 18:58:58 -08:00 committed by GitHub
parent fdc9245c5d
commit a633b269c1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 644 additions and 1247 deletions

File diff suppressed because it is too large Load diff

View file

@ -10,6 +10,7 @@ pub(crate) use {
libc::{EXIT_FAILURE, EXIT_SUCCESS},
pretty_assertions::Comparison,
regex::Regex,
serde::{Deserialize, Serialize},
serde_json::{json, Value},
std::{
collections::BTreeMap,
@ -28,6 +29,10 @@ pub(crate) use {
which::which,
};
fn default<T: Default>() -> T {
Default::default()
}
#[macro_use]
mod test;

View file

@ -170,7 +170,7 @@ impl Test {
}
pub(crate) fn stdout_regex(mut self, stdout_regex: impl AsRef<str>) -> Self {
self.stdout_regex = Some(Regex::new(&format!("^{}$", stdout_regex.as_ref())).unwrap());
self.stdout_regex = Some(Regex::new(&format!("(?s)^{}$", stdout_regex.as_ref())).unwrap());
self
}