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

Function test_matcher_serialization

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

Source from the content-addressed store, hash-verified

375
376 #[test]
377 fn test_matcher_serialization() {
378 let matcher = HookMatcher::tool("Bash").with_command("rm.*");
379
380 let json = serde_json::to_string(&matcher).unwrap();
381 assert!(json.contains("Bash"));
382 assert!(json.contains("rm.*"));
383
384 let parsed: HookMatcher = serde_json::from_str(&json).unwrap();
385 assert_eq!(parsed.tool, Some("Bash".to_string()));
386 assert_eq!(parsed.command_pattern, Some("rm.*".to_string()));
387 }
388
389 #[test]
390 fn test_path_with_alternative_field() {

Callers

nothing calls this directly

Calls 1

with_commandMethod · 0.80

Tested by

no test coverage detected