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

Function test_context_result_serialization

core/src/context/mod.rs:678–689  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

676
677 #[test]
678 fn test_context_result_serialization() {
679 let mut result = ContextResult::new("test-provider");
680 result.truncated = true;
681 result.add_item(ContextItem::new("id", ContextType::Resource, "content"));
682
683 let json = serde_json::to_string(&result).unwrap();
684 let parsed: ContextResult = serde_json::from_str(&json).unwrap();
685
686 assert_eq!(parsed.provider, "test-provider");
687 assert!(parsed.truncated);
688 assert_eq!(parsed.items.len(), 1);
689 }
690
691 #[test]
692 fn test_context_result_default() {

Callers

nothing calls this directly

Calls 1

add_itemMethod · 0.80

Tested by

no test coverage detected