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

Function test_command_pattern_matcher

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

Source from the content-addressed store, hash-verified

323
324 #[test]
325 fn test_command_pattern_matcher() {
326 let matcher = HookMatcher::command(r"rm\s+-rf");
327
328 let rm_event = make_pre_tool_event(
329 "s1",
330 "Bash",
331 serde_json::json!({"command": "rm -rf /tmp/test"}),
332 );
333 let echo_event =
334 make_pre_tool_event("s1", "Bash", serde_json::json!({"command": "echo hello"}));
335
336 assert!(matcher.matches(&rm_event));
337 assert!(!matcher.matches(&echo_event));
338 }
339
340 #[test]
341 fn test_combined_matchers() {

Callers

nothing calls this directly

Calls 1

make_pre_tool_eventFunction · 0.70

Tested by

no test coverage detected