chore: use assay for tests

This commit is contained in:
Harsh Shandilya 2022-02-15 11:31:57 +05:30
parent dc6966fb61
commit bf317fb353
No known key found for this signature in database
GPG key ID: 366D7BBAD1031E80
3 changed files with 226 additions and 5 deletions

View file

@ -1,6 +1,7 @@
use crate::config::{Act, Action, Match, Matcher};
use assay::assay;
#[test]
#[assay]
fn regex_matcher() {
let matcher = Matcher::Regex {
pattern: "^https.*",
@ -9,13 +10,13 @@ fn regex_matcher() {
assert!(!matcher.check_match("example.com"));
}
#[test]
#[assay]
fn set_action() {
let action = Action::Set { content: "doe" };
assert_eq!("doe", action.apply_action("john"));
}
#[test]
#[assay]
fn replace_action() {
let action = Action::Replace {
from: "doe",
@ -24,13 +25,13 @@ fn replace_action() {
assert_eq!("john bow", action.apply_action("john doe"));
}
#[test]
#[assay]
fn prefix_action() {
let action = Action::Prefix { prefix: "hello " };
assert_eq!("hello john", action.apply_action("john"));
}
#[test]
#[assay]
fn suffix_action() {
let action = Action::Suffix { suffix: " doe" };
assert_eq!("john doe", action.apply_action("john"));