From ef0c352cf28456bd30c853f342a74a13c22fc612 Mon Sep 17 00:00:00 2001 From: Vincent Thiberville Date: Mon, 10 Jul 2023 00:20:15 +0200 Subject: [PATCH] test: add coverage test on Regex::as_str --- boreal/src/regex.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/boreal/src/regex.rs b/boreal/src/regex.rs index 44deab56..435797ab 100644 --- a/boreal/src/regex.rs +++ b/boreal/src/regex.rs @@ -317,6 +317,14 @@ mod tests { ); } + #[test] + fn test_regex_as_str() { + // Original expression can be retrieved with the as_str method. + let expr = r"^a+b\wc"; + let regex = Regex::from_string(expr.to_owned(), false, false).unwrap(); + assert_eq!(regex.as_str(), expr); + } + #[test] fn test_types_traits() { test_type_traits(Regex::from_string("a".to_owned(), false, false));