Skip to content

Commit

Permalink
Add failing tests that demonstrates #99
Browse files Browse the repository at this point in the history
  • Loading branch information
Wilfred committed Jan 18, 2022
1 parent de02705 commit 2256c2f
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/hunks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -778,4 +778,35 @@ mod tests {
]
);
}

#[test]
#[ignore]
fn test_aligned_lines_when_hunk_doesnt_align() {
let hunk = Hunk {
lines: vec![(None, Some(0.into())), (Some(0.into()), None)],
};

let mut opposite_to_lhs = HashMap::new();
opposite_to_lhs.insert(0.into(), HashSet::from([0.into()]));
opposite_to_lhs.insert(1.into(), HashSet::from([1.into()]));

let mut opposite_to_rhs = HashMap::new();
opposite_to_rhs.insert(0.into(), HashSet::from([0.into()]));
opposite_to_rhs.insert(1.into(), HashSet::from([1.into()]));

let res = aligned_lines_from_hunk(
&hunk,
&opposite_to_lhs,
&opposite_to_rhs,
1.into(),
1.into(),
);
assert_eq!(
res,
vec![
(Some(0.into()), Some(0.into())),
(Some(1.into()), Some(1.into())),
]
);
}
}

0 comments on commit 2256c2f

Please sign in to comment.