feat: begin adding tests for matchers

This commit is contained in:
Harsh Shandilya 2022-02-15 02:54:56 +05:30
parent a112cbefc6
commit 86cb0fde40
No known key found for this signature in database
GPG key ID: 366D7BBAD1031E80
2 changed files with 12 additions and 0 deletions

View file

@ -1,4 +1,6 @@
mod config;
#[cfg(test)]
mod test;
use std::error::Error;
use std::ops::{Deref, Not};

10
src/test.rs Normal file
View file

@ -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"));
}