@@ -1653,6 +1653,42 @@ fn process_change_works_enclosing_addition() {
16531653 assert_eq ! ( offset_in_destination, Offset :: Added ( 3 ) ) ;
16541654}
16551655
1656+ #[ test]
1657+ fn process_change_works_enclosing_deletion ( ) {
1658+ let mut lines_blamed: Vec < BlameEntry > = vec ! [ ] ;
1659+ let mut new_hunks_to_blame: Vec < UnblamedHunk > = vec ! [ ] ;
1660+ let mut offset_in_destination: Offset = Offset :: Added ( 3 ) ;
1661+ let suspect = ObjectId :: null ( gix_hash:: Kind :: Sha1 ) ;
1662+
1663+ let ( hunk, change) = process_change (
1664+ & mut lines_blamed,
1665+ & mut new_hunks_to_blame,
1666+ & mut offset_in_destination,
1667+ suspect,
1668+ // range_in_destination: 13..20
1669+ Some ( UnblamedHunk :: new ( 12 ..19 , Offset :: Deleted ( 1 ) ) ) ,
1670+ Some ( Change :: Deleted ( 15 , 2 ) ) ,
1671+ ) ;
1672+
1673+ assert_eq ! (
1674+ hunk,
1675+ Some ( UnblamedHunk {
1676+ range_in_blamed_file: 14 ..19 ,
1677+ range_in_destination: 15 ..20
1678+ } )
1679+ ) ;
1680+ assert_eq ! ( change, None ) ;
1681+ assert_eq ! ( lines_blamed, vec![ ] ) ;
1682+ assert_eq ! (
1683+ new_hunks_to_blame,
1684+ vec![ UnblamedHunk {
1685+ range_in_blamed_file: 12 ..14 ,
1686+ range_in_destination: 10 ..12
1687+ } ]
1688+ ) ;
1689+ assert_eq ! ( offset_in_destination, Offset :: Added ( 1 ) ) ;
1690+ }
1691+
16561692#[ test]
16571693fn process_change_works_enclosing_unchanged_lines ( ) {
16581694 let mut lines_blamed: Vec < BlameEntry > = vec ! [ ] ;
0 commit comments