@@ -11,8 +11,11 @@ interface ITestLink {
11
11
link : string ;
12
12
prefix : string | undefined ;
13
13
suffix : string | undefined ;
14
+ // TODO: These has vars would be nicer as a flags enum
14
15
hasRow : boolean ;
15
16
hasCol : boolean ;
17
+ hasRowEnd ?: boolean ;
18
+ hasColEnd ?: boolean ;
16
19
}
17
20
18
21
const operatingSystems : ReadonlyArray < OperatingSystem > = [
@@ -33,6 +36,8 @@ const osLabel: { [key: number | OperatingSystem]: string } = {
33
36
34
37
const testRow = 339 ;
35
38
const testCol = 12 ;
39
+ const testRowEnd = 341 ;
40
+ const testColEnd = 14 ;
36
41
const testLinks : ITestLink [ ] = [
37
42
// Simple
38
43
{ link : 'foo' , prefix : undefined , suffix : undefined , hasRow : false , hasCol : false } ,
@@ -117,8 +122,9 @@ const testLinks: ITestLink[] = [
117
122
118
123
// OCaml-style
119
124
{ link : '"foo", line 339, character 12' , prefix : '"' , suffix : '", line 339, character 12' , hasRow : true , hasCol : true } ,
120
- { link : '"foo", line 339, characters 12-13' , prefix : '"' , suffix : '", line 339, characters 12-13' , hasRow : true , hasCol : true } ,
121
- { link : '"foo", lines 339-340' , prefix : '"' , suffix : '", lines 339-340' , hasRow : true , hasCol : false } ,
125
+ { link : '"foo", line 339, characters 12-14' , prefix : '"' , suffix : '", line 339, characters 12-14' , hasRow : true , hasCol : true , hasColEnd : true } ,
126
+ { link : '"foo", lines 339-341' , prefix : '"' , suffix : '", lines 339-341' , hasRow : true , hasCol : false , hasRowEnd : true } ,
127
+ { link : '"foo", lines 339-341, characters 12-14' , prefix : '"' , suffix : '", lines 339-341, characters 12-14' , hasRow : true , hasCol : true , hasRowEnd : true , hasColEnd : true } ,
122
128
123
129
// Non-breaking space
124
130
{ link : 'foo\u00A0339:12' , prefix : undefined , suffix : '\u00A0339:12' , hasRow : true , hasCol : true } ,
@@ -148,6 +154,8 @@ suite('TerminalLinkParsing', () => {
148
154
testLink . suffix === undefined ? null : {
149
155
row : testLink . hasRow ? testRow : undefined ,
150
156
col : testLink . hasCol ? testCol : undefined ,
157
+ rowEnd : testLink . hasRowEnd ? testRowEnd : undefined ,
158
+ colEnd : testLink . hasColEnd ? testColEnd : undefined ,
151
159
suffix : {
152
160
index : testLink . link . length - testLink . suffix . length ,
153
161
text : testLink . suffix
@@ -165,6 +173,8 @@ suite('TerminalLinkParsing', () => {
165
173
testLink . suffix === undefined ? [ ] : [ {
166
174
row : testLink . hasRow ? testRow : undefined ,
167
175
col : testLink . hasCol ? testCol : undefined ,
176
+ rowEnd : testLink . hasRowEnd ? testRowEnd : undefined ,
177
+ colEnd : testLink . hasColEnd ? testColEnd : undefined ,
168
178
suffix : {
169
179
index : testLink . link . length - testLink . suffix . length ,
170
180
text : testLink . suffix
@@ -181,6 +191,8 @@ suite('TerminalLinkParsing', () => {
181
191
{
182
192
col : 2 ,
183
193
row : 1 ,
194
+ rowEnd : undefined ,
195
+ colEnd : undefined ,
184
196
suffix : {
185
197
index : 3 ,
186
198
text : '(1, 2)'
@@ -189,6 +201,8 @@ suite('TerminalLinkParsing', () => {
189
201
{
190
202
col : 4 ,
191
203
row : 3 ,
204
+ rowEnd : undefined ,
205
+ colEnd : undefined ,
192
206
suffix : {
193
207
index : 13 ,
194
208
text : '[3, 4]'
@@ -197,6 +211,8 @@ suite('TerminalLinkParsing', () => {
197
211
{
198
212
col : undefined ,
199
213
row : 5 ,
214
+ rowEnd : undefined ,
215
+ colEnd : undefined ,
200
216
suffix : {
201
217
index : 23 ,
202
218
text : ' on line 5'
@@ -233,6 +249,8 @@ suite('TerminalLinkParsing', () => {
233
249
suffix : {
234
250
col : 2 ,
235
251
row : 1 ,
252
+ rowEnd : undefined ,
253
+ colEnd : undefined ,
236
254
suffix : {
237
255
index : 3 ,
238
256
text : '(1, 2)'
@@ -248,6 +266,8 @@ suite('TerminalLinkParsing', () => {
248
266
suffix : {
249
267
col : 4 ,
250
268
row : 3 ,
269
+ rowEnd : undefined ,
270
+ colEnd : undefined ,
251
271
suffix : {
252
272
index : 13 ,
253
273
text : '[3, 4]'
@@ -266,6 +286,8 @@ suite('TerminalLinkParsing', () => {
266
286
suffix : {
267
287
col : undefined ,
268
288
row : 5 ,
289
+ rowEnd : undefined ,
290
+ colEnd : undefined ,
269
291
suffix : {
270
292
index : 24 ,
271
293
text : '" on line 5'
@@ -292,6 +314,8 @@ suite('TerminalLinkParsing', () => {
292
314
suffix : {
293
315
row : 5 ,
294
316
col : 6 ,
317
+ rowEnd : undefined ,
318
+ colEnd : undefined ,
295
319
suffix : {
296
320
index : 4 ,
297
321
text : '", line 5, col 6'
@@ -318,6 +342,8 @@ suite('TerminalLinkParsing', () => {
318
342
suffix : {
319
343
row : 5 ,
320
344
col : 6 ,
345
+ rowEnd : undefined ,
346
+ colEnd : undefined ,
321
347
suffix : {
322
348
index : 10 ,
323
349
text : '", line 5, col 6'
@@ -353,6 +379,8 @@ suite('TerminalLinkParsing', () => {
353
379
suffix : {
354
380
row : 5 ,
355
381
col : 6 ,
382
+ rowEnd : undefined ,
383
+ colEnd : undefined ,
356
384
suffix : {
357
385
index : 41 ,
358
386
text : '", line 5, col 6'
@@ -392,6 +420,8 @@ suite('TerminalLinkParsing', () => {
392
420
suffix : {
393
421
col : undefined ,
394
422
row : 400 ,
423
+ rowEnd : undefined ,
424
+ colEnd : undefined ,
395
425
suffix : {
396
426
index : 27 ,
397
427
text : ':400'
@@ -446,6 +476,8 @@ suite('TerminalLinkParsing', () => {
446
476
suffix : {
447
477
col : undefined ,
448
478
row : 400 ,
479
+ rowEnd : undefined ,
480
+ colEnd : undefined ,
449
481
suffix : {
450
482
index : 1 + osTestPath [ os ] . length ,
451
483
text : ':400'
@@ -466,6 +498,8 @@ suite('TerminalLinkParsing', () => {
466
498
suffix : {
467
499
col : undefined ,
468
500
row : 400 ,
501
+ rowEnd : undefined ,
502
+ colEnd : undefined ,
469
503
suffix : {
470
504
index : 1 + osTestPath [ os ] . length ,
471
505
text : ':400'
@@ -573,7 +607,7 @@ suite('TerminalLinkParsing', () => {
573
607
const link2 = testLinksWithSuffix [ i + 1 ] ;
574
608
const link3 = testLinksWithSuffix [ i + 2 ] ;
575
609
const line = ` ${ link1 . link } ${ link2 . link } ${ link3 . link } ` ;
576
- test ( '`' + line + '`' , ( ) => {
610
+ test ( '`' + line . replaceAll ( '\u00A0' , '<nbsp>' ) + '`' , ( ) => {
577
611
strictEqual ( detectLinks ( line , OperatingSystem . Linux ) . length , 3 ) ;
578
612
ok ( link1 . suffix ) ;
579
613
ok ( link2 . suffix ) ;
@@ -590,6 +624,8 @@ suite('TerminalLinkParsing', () => {
590
624
suffix : {
591
625
row : link1 . hasRow ? testRow : undefined ,
592
626
col : link1 . hasCol ? testCol : undefined ,
627
+ rowEnd : link1 . hasRowEnd ? testRowEnd : undefined ,
628
+ colEnd : link1 . hasColEnd ? testColEnd : undefined ,
593
629
suffix : {
594
630
index : 1 + ( link1 . link . length - link1 . suffix . length ) ,
595
631
text : link1 . suffix
@@ -608,6 +644,8 @@ suite('TerminalLinkParsing', () => {
608
644
suffix : {
609
645
row : link2 . hasRow ? testRow : undefined ,
610
646
col : link2 . hasCol ? testCol : undefined ,
647
+ rowEnd : link2 . hasRowEnd ? testRowEnd : undefined ,
648
+ colEnd : link2 . hasColEnd ? testColEnd : undefined ,
611
649
suffix : {
612
650
index : ( detectedLink1 . prefix ?. index ?? detectedLink1 . path . index ) + link1 . link . length + 1 + ( link2 . link . length - link2 . suffix . length ) ,
613
651
text : link2 . suffix
@@ -626,6 +664,8 @@ suite('TerminalLinkParsing', () => {
626
664
suffix : {
627
665
row : link3 . hasRow ? testRow : undefined ,
628
666
col : link3 . hasCol ? testCol : undefined ,
667
+ rowEnd : link3 . hasRowEnd ? testRowEnd : undefined ,
668
+ colEnd : link3 . hasColEnd ? testColEnd : undefined ,
629
669
suffix : {
630
670
index : ( detectedLink2 . prefix ?. index ?? detectedLink2 . path . index ) + link2 . link . length + 1 + ( link3 . link . length - link3 . suffix . length ) ,
631
671
text : link3 . suffix
0 commit comments