use cfait::model::Task;
use std::collections::HashMap;
fn create_task_with_loc(summary: &str, location: &str) -> Task {
let mut t = Task::new(summary, &HashMap::new(), None);
t.location = Some(location.to_string());
t
}
#[test]
fn test_implicit_location_search() {
let t = create_task_with_loc("Buy Milk", "Supermarket");
assert!(t.matches_search_term("@@Supermarket"));
assert!(t.matches_search_term("loc:Supermarket"));
assert!(t.matches_search_term("Supermarket"));
assert!(t.matches_search_term("market"));
assert!(t.matches_search_term("supermarket"));
assert!(!t.matches_search_term("Office"));
}
#[test]
fn test_mixed_filters() {
let mut t = create_task_with_loc("Meeting", "Office");
t.priority = 1;
assert!(t.matches_search_term("!1 Office"));
assert!(!t.matches_search_term("!1 Home"));
}