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

Function test_context_result_xml_formatting_complex

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

Source from the content-addressed store, hash-verified

851
852 #[test]
853 fn test_context_result_xml_formatting_complex() {
854 let mut result = ContextResult::new("openviking");
855 result.add_item(
856 ContextItem::new(
857 "doc-1",
858 ContextType::Resource,
859 "Authentication uses JWT tokens stored in httpOnly cookies.",
860 )
861 .with_source("viking://docs/auth")
862 .with_token_count(50),
863 );
864 result.add_item(
865 ContextItem::new(
866 "mem-1",
867 ContextType::Memory,
868 "User prefers TypeScript over JavaScript.",
869 )
870 .with_token_count(30),
871 );
872
873 let xml = result.to_xml();
874
875 // Verify structure
876 assert!(xml.contains("<context source=\"viking://docs/auth\" type=\"Resource\">"));
877 assert!(xml.contains("Authentication uses JWT tokens"));
878 assert!(xml.contains("<context type=\"Memory\">"));
879 assert!(xml.contains("User prefers TypeScript"));
880
881 // Verify items are separated
882 assert!(xml.contains("</context>\n\n<context"));
883 }
884}

Callers

nothing calls this directly

Calls 4

add_itemMethod · 0.80
with_token_countMethod · 0.80
with_sourceMethod · 0.80
to_xmlMethod · 0.45

Tested by

no test coverage detected