MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / test_merge_both_existing_and_new

Function test_merge_both_existing_and_new

atomic-agent/src/learnings.rs:963–984  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

961
962 #[test]
963 fn test_merge_both_existing_and_new() {
964 let existing = format!(
965 "{}\n\n### Repo\n- Old repo\n\n### Workflow\n- Old workflow\n\n{}\n",
966 SECTION_START, SECTION_END
967 );
968 let mut new_items = HashMap::new();
969 new_items.insert("### Repo".to_string(), vec!["- New repo".to_string()]);
970 new_items.insert(
971 "### Workflow".to_string(),
972 vec!["- New workflow".to_string()],
973 );
974 let result = merge_items_into_section(&existing, &new_items);
975
976 // Each heading once
977 assert_eq!(result.matches("### Repo").count(), 1);
978 assert_eq!(result.matches("### Workflow").count(), 1);
979 // All items present
980 assert!(result.contains("- Old repo"));
981 assert!(result.contains("- New repo"));
982 assert!(result.contains("- Old workflow"));
983 assert!(result.contains("- New workflow"));
984 }
985
986 // save_learnings_to_context_file (filesystem tests)
987

Callers

nothing calls this directly

Calls 2

merge_items_into_sectionFunction · 0.85
insertMethod · 0.45

Tested by

no test coverage detected