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

Function test_unified_diff_deletion

atomic-core/src/diff/display.rs:859–874  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

857
858 #[test]
859 fn test_unified_diff_deletion() {
860 let old = b"line1\nline2\nline3\n";
861 let new = b"line1\nline3\n";
862 let diff = UnifiedDiff::new(old, new, Algorithm::Myers);
863
864 assert!(diff.has_changes());
865 assert_eq!(diff.additions(), 0);
866 assert_eq!(diff.deletions(), 1);
867
868 let lines: Vec<_> = diff.lines().collect();
869 // 2 unchanged + 1 removed = 3 lines
870 assert_eq!(lines.len(), 3);
871 assert_eq!(lines[0].status, LineStatus::Unchanged);
872 assert_eq!(lines[1].status, LineStatus::Removed);
873 assert_eq!(lines[2].status, LineStatus::Unchanged);
874 }
875
876 #[test]
877 fn test_unified_diff_replacement() {

Callers

nothing calls this directly

Calls 1

linesMethod · 0.45

Tested by

no test coverage detected