diff --git a/src/main.rs b/src/main.rs index 9a65734..ea1c291 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,6 @@ mod config; +#[cfg(test)] +mod test; use std::error::Error; use std::ops::{Deref, Not}; diff --git a/src/test.rs b/src/test.rs new file mode 100644 index 0000000..077bd63 --- /dev/null +++ b/src/test.rs @@ -0,0 +1,10 @@ +use crate::config::{Match, Matcher}; + +#[test] +fn regex_matcher() { + let matcher = Matcher::Regex { + pattern: "^https.*", + }; + assert!(matcher.check_match("https://example.com")); + assert!(!matcher.check_match("example.com")); +}