MCPcopy Create free account
hub / github.com/AI45Lab/Code / test_combined_matchers

Function test_combined_matchers

core/src/hooks/matcher.rs:341–353  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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() {

Callers

nothing calls this directly

Calls 3

with_commandMethod · 0.80
make_pre_tool_eventFunction · 0.70
with_toolMethod · 0.45

Tested by

no test coverage detected