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