mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-30 16:10:23 +00:00
test_merged_tree: nest each part of test_diff_dir_file()
I'm about to add a few more checks for diffing with a matcher. I think it will help make it readable and reduce the risk of mixing up variables between each part of the test if we use some nested blocks. I also removed some unnecessary `.clone()` calls while at it.
This commit is contained in:
parent
c9ce80a82a
commit
16aa8e8f10
1 changed files with 124 additions and 124 deletions
|
@ -906,16 +906,12 @@ fn test_diff_dir_file() {
|
|||
(&path6.join(&file), "right"),
|
||||
],
|
||||
);
|
||||
let left_merged = MergedTree::new(Merge::new(
|
||||
vec![left_base.clone()],
|
||||
vec![left_side1.clone(), left_side2.clone()],
|
||||
));
|
||||
let right_merged = MergedTree::new(Merge::new(
|
||||
vec![right_base.clone()],
|
||||
vec![right_side1.clone(), right_side2.clone()],
|
||||
));
|
||||
let left_merged = MergedTree::new(Merge::new(vec![left_base], vec![left_side1, left_side2]));
|
||||
let right_merged =
|
||||
MergedTree::new(Merge::new(vec![right_base], vec![right_side1, right_side2]));
|
||||
|
||||
// Test the forwards diff
|
||||
{
|
||||
let actual_diff = left_merged
|
||||
.diff(&right_merged, &EverythingMatcher)
|
||||
.map(|(path, diff)| (path, diff.unwrap()))
|
||||
|
@ -976,7 +972,10 @@ fn test_diff_dir_file() {
|
|||
),
|
||||
];
|
||||
assert_eq!(actual_diff, expected_diff);
|
||||
}
|
||||
|
||||
// Test the reverse diff
|
||||
{
|
||||
let actual_diff = right_merged
|
||||
.diff(&left_merged, &EverythingMatcher)
|
||||
.map(|(path, diff)| (path, diff.unwrap()))
|
||||
|
@ -1038,6 +1037,7 @@ fn test_diff_dir_file() {
|
|||
];
|
||||
assert_eq!(actual_diff, expected_diff);
|
||||
}
|
||||
}
|
||||
|
||||
/// Merge 3 resolved trees that can be resolved
|
||||
#[test]
|
||||
|
|
Loading…
Reference in a new issue