Fix test for overlapping changes (#22741)

This commit is contained in:
Andy
2018-03-22 08:11:27 -07:00
committed by GitHub
parent 3a3f57acfd
commit effcf2ac56

View File

@@ -634,7 +634,7 @@ namespace ts.textChanges {
// order changes by start position
const normalized = stableSort(changesInFile, (a, b) => a.range.pos - b.range.pos);
// verify that change intervals do not overlap, except possibly at end points.
for (let i = 0; i < normalized.length - 2; i++) {
for (let i = 0; i < normalized.length - 1; i++) {
Debug.assert(normalized[i].range.end <= normalized[i + 1].range.pos, "Changes overlap", () =>
`${JSON.stringify(normalized[i].range)} and ${JSON.stringify(normalized[i + 1].range)}`);
}