Skip to content

Commit f0bfb2e

Browse files
committed
Fixes tests.
1 parent 525509f commit f0bfb2e

File tree

1 file changed

+34
-28
lines changed

1 file changed

+34
-28
lines changed

src/vs/editor/test/common/model/bracketPairColorizer/beforeEditPositionMapper.test.ts

Lines changed: 34 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ suite('Bracket Pair Colorizer - BeforeEditPositionMapper', () => {
2727
'0 0 0 0 0 0 0 0 0 0 ', // the old line numbers
2828
'0 1 2 3 4 5 7 8 9 10 ', // the old columns
2929

30-
'0 0 0 0 0 0 0 0 0 0 ', // line count until next change
31-
'4 3 2 1 0 0 3 2 1 0 ', // column count until next change
30+
'0 0 0 0 0 0 ∞ ∞ ∞ ∞ ', // line count until next change
31+
'4 3 2 1 0 0 ∞ ∞ ∞ ∞ ', // column count until next change
3232
]
3333
);
3434
});
@@ -50,8 +50,8 @@ suite('Bracket Pair Colorizer - BeforeEditPositionMapper', () => {
5050
'0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ',
5151
'0 1 2 3 4 5 4 5 6 7 6 7 8 9 10 ',
5252

53-
'0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ',
54-
'2 1 0 0 0 0 2 1 0 0 4 3 2 1 0 ',
53+
'0 0 0 0 0 0 0 0 0 0 ∞ ∞ ∞ ∞ ∞ ',
54+
'2 1 0 0 0 0 2 1 0 0 ∞ ∞ ∞ ∞ ∞ ',
5555
]
5656
);
5757
});
@@ -75,16 +75,16 @@ suite('Bracket Pair Colorizer - BeforeEditPositionMapper', () => {
7575
'0 0 0 0 0 1 1 1 1 1 1 1 1 ',
7676
'0 1 2 3 4 3 4 5 6 7 8 9 10 ',
7777

78-
'0 0 0 0 0 1 1 1 1 1 1 1 1 ',
79-
'3 2 1 0 0 10 10 10 10 10 10 10 10 ',
78+
"0 0 0 0 0 ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ",
79+
'3 2 1 0 0 ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ',
8080
// ------------------
8181
'⁰ ¹ ² ³ ⁴ ⁵ ⁶ ⁷ ⁸ ⁹ ',
8282

8383
'2 2 2 2 2 2 2 2 2 2 2 ',
8484
'0 1 2 3 4 5 6 7 8 9 10 ',
8585

86-
'0 0 0 0 0 0 0 0 0 0 0 ',
87-
'10 9 8 7 6 5 4 3 2 1 0 ',
86+
'∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ',
87+
'∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ',
8888
]
8989
);
9090
});
@@ -109,16 +109,16 @@ suite('Bracket Pair Colorizer - BeforeEditPositionMapper', () => {
109109
'0 0 0 0 0 1 1 1 1 1 1 1 1 1 ',
110110
'0 1 2 3 4 0 1 2 3 4 5 7 8 9 ',
111111

112-
'0 0 0 0 0 0 0 0 0 0 0 1 1 1 ',
113-
'3 2 1 0 0 5 4 3 2 1 0 10 10 10 ',
112+
'0 0 0 0 0 0 0 0 0 0 0 ∞ ∞ ∞ ',
113+
'3 2 1 0 0 5 4 3 2 1 0 ∞ ∞ ∞ ',
114114
// ------------------
115115
'⁰ ¹ ² ³ ⁴ ⁵ ⁶ ⁷ ⁸ ⁹ ',
116116

117117
'2 2 2 2 2 2 2 2 2 2 2 ',
118118
'0 1 2 3 4 5 6 7 8 9 10 ',
119119

120-
'0 0 0 0 0 0 0 0 0 0 0 ',
121-
'10 9 8 7 6 5 4 3 2 1 0 ',
120+
'∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ',
121+
'∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ',
122122
]
123123
);
124124
});
@@ -144,8 +144,8 @@ suite('Bracket Pair Colorizer - BeforeEditPositionMapper', () => {
144144
'0 0 0 0 0 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 ',
145145
'0 1 2 3 4 0 1 2 3 4 5 7 8 4 5 6 7 8 9 10 ',
146146

147-
'0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ',
148-
'3 2 1 0 0 5 4 3 2 1 0 1 0 6 5 4 3 2 1 0 ',
147+
'0 0 0 0 0 0 0 0 0 0 0 0 0 ∞ ∞ ∞ ∞ ∞ ∞ ∞ ',
148+
'3 2 1 0 0 5 4 3 2 1 0 1 0 ∞ ∞ ∞ ∞ ∞ ∞ ∞ ',
149149
]
150150
);
151151
});
@@ -175,8 +175,8 @@ suite('Bracket Pair Colorizer - BeforeEditPositionMapper', () => {
175175
'1 0 0 0 0 0 ',
176176
'0 5 6 7 8 9 ',
177177

178-
'0 0 0 0 0 0 ',
179-
'0 4 3 2 1 0 ',
178+
'0 ∞ ∞ ∞ ∞ ∞ ',
179+
'0 ∞ ∞ ∞ ∞ ∞ ',
180180
]
181181
);
182182
});
@@ -215,8 +215,8 @@ suite('Bracket Pair Colorizer - BeforeEditPositionMapper', () => {
215215
'1 0 0 ',
216216
'0 8 9 ',
217217

218-
'0 0 0 ',
219-
'0 1 0 ',
218+
'0 ∞ ∞ ',
219+
'0 ∞ ∞ ',
220220
]
221221
);
222222
});
@@ -247,16 +247,16 @@ suite('Bracket Pair Colorizer - BeforeEditPositionMapper', () => {
247247
'1 1 1 1 1 1 1 1 1 1 1 1 ',
248248
'0 1 2 1 2 3 4 5 6 7 8 9 ',
249249

250-
'0 0 0 1 1 1 1 1 1 1 1 1 ',
251-
'0 0 0 10 10 10 10 10 10 10 10 10 ',
250+
'0 0 0 ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ',
251+
'0 0 0 ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ',
252252
// ------------------
253253
'⁰ ¹ ² ³ ⁴ ⁵ ⁶ ⁷ ⁸ ⁹ ',
254254

255255
'2 2 2 2 2 2 2 2 2 2 2 ',
256256
'0 1 2 3 4 5 6 7 8 9 10 ',
257257

258-
'0 0 0 0 0 0 0 0 0 0 0 ',
259-
'10 9 8 7 6 5 4 3 2 1 0 ',
258+
'∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ',
259+
'∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ',
260260
]
261261
);
262262
});
@@ -306,8 +306,8 @@ suite('Bracket Pair Colorizer - BeforeEditPositionMapper', () => {
306306
'2 2 2 2 2 2 2 2 ',
307307
'0 4 5 6 7 8 9 10 ',
308308

309-
'0 0 0 0 0 0 0 0 ',
310-
'0 6 5 4 3 2 1 0 ',
309+
'0 ∞ ∞ ∞ ∞ ∞ ∞ ∞ ',
310+
'0 ∞ ∞ ∞ ∞ ∞ ∞ ∞ ',
311311
]
312312
);
313313
});
@@ -320,7 +320,7 @@ function compute(inputArr: string[], edits: TextEdit[]): string[] {
320320
range: Range.fromPositions(lengthToPosition(e.startOffset), lengthToPosition(e.endOffset))
321321
}))));
322322

323-
const mapper = new BeforeEditPositionMapper(edits, lengthOfString(newLines.join('\n')));
323+
const mapper = new BeforeEditPositionMapper(edits);
324324

325325
const result = new Array<string>();
326326

@@ -342,9 +342,15 @@ function compute(inputArr: string[], edits: TextEdit[]): string[] {
342342
lineLine += rightPad('' + beforeObj.lineCount, 3);
343343
colLine += rightPad('' + beforeObj.columnCount, 3);
344344

345-
const dist = lengthToObj(mapper.getDistanceToNextChange(toLength(lineIdx, colIdx)));
346-
lineDist += rightPad('' + dist.lineCount, 3);
347-
colDist += rightPad('' + dist.columnCount, 3);
345+
const distLen = mapper.getDistanceToNextChange(toLength(lineIdx, colIdx));
346+
if (distLen === null) {
347+
lineDist += '∞ ';
348+
colDist += '∞ ';
349+
} else {
350+
const dist = lengthToObj(distLen);
351+
lineDist += rightPad('' + dist.lineCount, 3);
352+
colDist += rightPad('' + dist.columnCount, 3);
353+
}
348354
}
349355
result.push(lineStr);
350356

0 commit comments

Comments
 (0)