()
| 339 | |
| 340 | #[test] |
| 341 | fn test_combined_matchers() { |
| 342 | let matcher = HookMatcher::new().with_tool("Bash").with_command("rm"); |
| 343 | |
| 344 | let bash_rm = |
| 345 | make_pre_tool_event("s1", "Bash", serde_json::json!({"command": "rm file.txt"})); |
| 346 | let bash_echo = |
| 347 | make_pre_tool_event("s1", "Bash", serde_json::json!({"command": "echo hello"})); |
| 348 | let read_event = make_pre_tool_event("s1", "Read", serde_json::json!({"path": "file.txt"})); |
| 349 | |
| 350 | assert!(matcher.matches(&bash_rm)); |
| 351 | assert!(!matcher.matches(&bash_echo)); // Bash but no rm |
| 352 | assert!(!matcher.matches(&read_event)); // Not Bash |
| 353 | } |
| 354 | |
| 355 | #[test] |
| 356 | fn test_command_pattern_not_bash() { |
nothing calls this directly
no test coverage detected