Skip to content

Commit

Permalink
conflicts: demo failure to materialize if conflicts don't end in a ne…
Browse files Browse the repository at this point in the history
…wline

jj-vcs#3968
  • Loading branch information
ilyagr committed Jun 26, 2024
1 parent e2138ca commit af6e7e4
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions lib/tests/test_conflicts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,36 @@ fn test_materialize_parse_roundtrip() {
"###);
}

#[test]
fn test_materialize_conflict_no_newlines_at_eof() {
let test_repo = TestRepo::init();
let store = test_repo.repo.store();

let path = RepoPath::from_internal_string("file");
let base_id = testutils::write_file(store, path, "base");
let left_empty_id = testutils::write_file(store, path, "");
let right_id = testutils::write_file(store, path, "right");

let conflict = Merge::from_removes_adds(
vec![Some(base_id.clone())],
vec![Some(left_empty_id.clone()), Some(right_id.clone())],
);
let materialized = &materialize_conflict_string(store, path, &conflict);
insta::assert_snapshot!(materialized,
@r###"
<<<<<<< Conflict 1 of 1
%%%%%%% Changes from base to side #1
-base+++++++ Contents of side #2
right>>>>>>> Conflict 1 of 1 ends
"###
);
// BUG(#3968): These conflict markers cannot be parsed
insta::assert_debug_snapshot!(parse_conflict(
materialized.as_bytes(),
conflict.num_sides()
),@"None");
}

#[test]
fn test_materialize_conflict_modify_delete() {
let test_repo = TestRepo::init();
Expand Down

0 comments on commit af6e7e4

Please sign in to comment.