testConflictMarkersAreOnlyRealOnes
tcmts.cli.merge.testConflictMarkersAreOnlyRealOnes · #yxjhjpgi · term
import { conflictMarkers } from "#codebase/tcmts/cli/merge";
import assert from "node:assert/strict";
export const testConflictMarkersAreOnlyRealOnes = () => {
const marked = "<<<<<<< ours (s)\na\n||||||| base\nb\n=======\nc\n>>>>>>> theirs (main)";
assert.equal(conflictMarkers(`x\n${marked}\ny`), 2);
assert.equal(
conflictMarkers("<<<<<<<\na\n=======\nc\n>>>>>>>"),
1,
"unlabelled, without the base's",
);
// text quoting them, as tcm_edit's description does, isn't marked
assert.equal(
conflictMarkers(
'description: "conflict markers (<<<<<<< ours … ||||||| base … ======= … >>>>>>> theirs) only where"',
),
undefined,
);
assert.equal(
conflictMarkers(" <<<<<<< ours\n =======\n >>>>>>> theirs"),
undefined,
"indented",
);
assert.equal(conflictMarkers("<<<<<<<< ours\n=======\n>>>>>>>> theirs"), undefined, "eight wide");
assert.equal(
conflictMarkers("<<<<<<<ours\n=======\n>>>>>>>theirs"),
undefined,
"no space before the label",
);
assert.equal(conflictMarkers(">>>>>>> theirs\n=======\n<<<<<<< ours"), undefined, "out of order");
assert.equal(conflictMarkers("<<<<<<< ours\na\n>>>>>>> theirs"), undefined, "no =======");
}
uses