Changeset: Migrate from mergingOpAssembler() to squashOps()

This commit is contained in:
Richard Hansen 2021-10-21 00:49:04 -04:00
parent daa6b9074a
commit 2448fb8e41
4 changed files with 63 additions and 58 deletions

View file

@ -129,16 +129,17 @@ describe('easysync-other', function () {
describe('split/join attribution lines', function () {
const testSplitJoinAttributionLines = (randomSeed) => {
const stringToOps = (str) => {
const assem = Changeset.mergingOpAssembler();
const o = new Changeset.Op('+');
o.chars = 1;
for (let i = 0; i < str.length; i++) {
const c = str.charAt(i);
o.lines = (c === '\n' ? 1 : 0);
o.attribs = (c === 'a' || c === 'b' ? `*${c}` : '');
assem.append(o);
}
return assem.toString();
const ops = (function* () {
for (let i = 0; i < str.length; i++) {
const c = str.charAt(i);
const o = new Changeset.Op('+');
o.chars = 1;
o.lines = (c === '\n' ? 1 : 0);
o.attribs = (c === 'a' || c === 'b' ? `*${c}` : '');
yield o;
}
})();
return Changeset.serializeOps(Changeset.squashOps(ops, false));
};
it(`testSplitJoinAttributionLines#${randomSeed}`, async function () {