mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-18 10:07:28 +00:00
conflicts: use insta
in conflict tests
This commit is contained in:
parent
9dab88260a
commit
fc578a2dd7
1 changed files with 51 additions and 49 deletions
|
@ -16,6 +16,7 @@ use jujutsu_lib::backend::{Conflict, ConflictPart, TreeValue};
|
|||
use jujutsu_lib::conflicts::{materialize_conflict, parse_conflict, update_conflict_from_content};
|
||||
use jujutsu_lib::files::MergeHunk;
|
||||
use jujutsu_lib::repo_path::RepoPath;
|
||||
use jujutsu_lib::store::Store;
|
||||
use jujutsu_lib::testutils;
|
||||
use jujutsu_lib::testutils::TestRepo;
|
||||
|
||||
|
@ -78,11 +79,10 @@ line 5
|
|||
},
|
||||
],
|
||||
};
|
||||
let mut result: Vec<u8> = vec![];
|
||||
materialize_conflict(store, &path, &conflict, &mut result).unwrap();
|
||||
assert_eq!(
|
||||
String::from_utf8(result).unwrap().as_str(),
|
||||
"line 1
|
||||
insta::assert_snapshot!(
|
||||
&materialize_conflict_string(store, &path, &conflict),
|
||||
@r###"
|
||||
line 1
|
||||
line 2
|
||||
<<<<<<<
|
||||
-------
|
||||
|
@ -94,7 +94,7 @@ right
|
|||
>>>>>>>
|
||||
line 4
|
||||
line 5
|
||||
"
|
||||
"###
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -156,11 +156,8 @@ line 5
|
|||
},
|
||||
],
|
||||
};
|
||||
let mut result: Vec<u8> = vec![];
|
||||
materialize_conflict(store, &path, &conflict, &mut result).unwrap();
|
||||
assert_eq!(
|
||||
String::from_utf8(result).unwrap().as_str(),
|
||||
"line 1
|
||||
insta::assert_snapshot!(&materialize_conflict_string(store, &path, &conflict), @r###"
|
||||
line 1
|
||||
line 2
|
||||
<<<<<<<
|
||||
-------
|
||||
|
@ -171,7 +168,7 @@ line 2
|
|||
>>>>>>>
|
||||
line 4
|
||||
line 5
|
||||
"
|
||||
"###
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -234,11 +231,10 @@ line 5
|
|||
],
|
||||
};
|
||||
|
||||
let mut result: Vec<u8> = vec![];
|
||||
materialize_conflict(store, &path, &conflict, &mut result).unwrap();
|
||||
assert_eq!(
|
||||
String::from_utf8(result).unwrap().as_str(),
|
||||
"line 1
|
||||
insta::assert_snapshot!(
|
||||
&materialize_conflict_string(store, &path, &conflict),
|
||||
@r###"
|
||||
line 1
|
||||
line 2
|
||||
<<<<<<<
|
||||
-------
|
||||
|
@ -249,7 +245,7 @@ right
|
|||
>>>>>>>
|
||||
line 4
|
||||
line 5
|
||||
"
|
||||
"###
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -503,3 +499,9 @@ fn test_update_conflict_from_content() {
|
|||
}
|
||||
)
|
||||
}
|
||||
|
||||
fn materialize_conflict_string(store: &Store, path: &RepoPath, conflict: &Conflict) -> String {
|
||||
let mut result: Vec<u8> = vec![];
|
||||
materialize_conflict(store, path, conflict, &mut result).unwrap();
|
||||
String::from_utf8(result).unwrap()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue