use once_cell::sync::Lazy;
use regex::Regex;
pub(crate) static STRONG: Lazy<Regex> = Lazy::new(|| {
Regex::new(r"(?i)\b(error|fatal|fail(?:ed|ure)?|panic(?:ked)?|exception|traceback|segfault|assert(?:ion)?|not ok)\b|(?i)failure")
.unwrap()
});
pub(crate) static WARN: Lazy<Regex> =
Lazy::new(|| Regex::new(r"(?i)\b(warn(?:ing)?|deprecat)").unwrap());
pub(crate) static LEVEL: Lazy<Regex> = Lazy::new(|| {
Regex::new(r"(?i)\b(error|warn|info|debug|trace|fatal|fail|panic|exception)\b").unwrap()
});
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn strong_matches_tap_failure_markers() {
assert!(STRONG.is_match("not ok 19 - normalize: backslash path"));
assert!(STRONG.is_match(" failureType: 'testCodeFailure'"));
assert!(STRONG.is_match("[10:02:31Z] ERROR src/worker/pool.rs:214"));
assert!(!STRONG.is_match("ok 19 - normalize: backslash path"));
assert!(!STRONG.is_match("ok 30 - isInList: FAIL_OPEN path returns true"));
}
}