@@ -11,8 +11,11 @@ interface ITestLink {
1111 link : string ;
1212 prefix : string | undefined ;
1313 suffix : string | undefined ;
14+ // TODO: These has vars would be nicer as a flags enum
1415 hasRow : boolean ;
1516 hasCol : boolean ;
17+ hasRowEnd ?: boolean ;
18+ hasColEnd ?: boolean ;
1619}
1720
1821const operatingSystems : ReadonlyArray < OperatingSystem > = [
@@ -33,6 +36,8 @@ const osLabel: { [key: number | OperatingSystem]: string } = {
3336
3437const testRow = 339 ;
3538const testCol = 12 ;
39+ const testRowEnd = 341 ;
40+ const testColEnd = 14 ;
3641const testLinks : ITestLink [ ] = [
3742 // Simple
3843 { link : 'foo' , prefix : undefined , suffix : undefined , hasRow : false , hasCol : false } ,
@@ -117,8 +122,9 @@ const testLinks: ITestLink[] = [
117122
118123 // OCaml-style
119124 { 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 } ,
122128
123129 // Non-breaking space
124130 { link : 'foo\u00A0339:12' , prefix : undefined , suffix : '\u00A0339:12' , hasRow : true , hasCol : true } ,
@@ -148,6 +154,8 @@ suite('TerminalLinkParsing', () => {
148154 testLink . suffix === undefined ? null : {
149155 row : testLink . hasRow ? testRow : undefined ,
150156 col : testLink . hasCol ? testCol : undefined ,
157+ rowEnd : testLink . hasRowEnd ? testRowEnd : undefined ,
158+ colEnd : testLink . hasColEnd ? testColEnd : undefined ,
151159 suffix : {
152160 index : testLink . link . length - testLink . suffix . length ,
153161 text : testLink . suffix
@@ -165,6 +173,8 @@ suite('TerminalLinkParsing', () => {
165173 testLink . suffix === undefined ? [ ] : [ {
166174 row : testLink . hasRow ? testRow : undefined ,
167175 col : testLink . hasCol ? testCol : undefined ,
176+ rowEnd : testLink . hasRowEnd ? testRowEnd : undefined ,
177+ colEnd : testLink . hasColEnd ? testColEnd : undefined ,
168178 suffix : {
169179 index : testLink . link . length - testLink . suffix . length ,
170180 text : testLink . suffix
@@ -181,6 +191,8 @@ suite('TerminalLinkParsing', () => {
181191 {
182192 col : 2 ,
183193 row : 1 ,
194+ rowEnd : undefined ,
195+ colEnd : undefined ,
184196 suffix : {
185197 index : 3 ,
186198 text : '(1, 2)'
@@ -189,6 +201,8 @@ suite('TerminalLinkParsing', () => {
189201 {
190202 col : 4 ,
191203 row : 3 ,
204+ rowEnd : undefined ,
205+ colEnd : undefined ,
192206 suffix : {
193207 index : 13 ,
194208 text : '[3, 4]'
@@ -197,6 +211,8 @@ suite('TerminalLinkParsing', () => {
197211 {
198212 col : undefined ,
199213 row : 5 ,
214+ rowEnd : undefined ,
215+ colEnd : undefined ,
200216 suffix : {
201217 index : 23 ,
202218 text : ' on line 5'
@@ -233,6 +249,8 @@ suite('TerminalLinkParsing', () => {
233249 suffix : {
234250 col : 2 ,
235251 row : 1 ,
252+ rowEnd : undefined ,
253+ colEnd : undefined ,
236254 suffix : {
237255 index : 3 ,
238256 text : '(1, 2)'
@@ -248,6 +266,8 @@ suite('TerminalLinkParsing', () => {
248266 suffix : {
249267 col : 4 ,
250268 row : 3 ,
269+ rowEnd : undefined ,
270+ colEnd : undefined ,
251271 suffix : {
252272 index : 13 ,
253273 text : '[3, 4]'
@@ -266,6 +286,8 @@ suite('TerminalLinkParsing', () => {
266286 suffix : {
267287 col : undefined ,
268288 row : 5 ,
289+ rowEnd : undefined ,
290+ colEnd : undefined ,
269291 suffix : {
270292 index : 24 ,
271293 text : '" on line 5'
@@ -292,6 +314,8 @@ suite('TerminalLinkParsing', () => {
292314 suffix : {
293315 row : 5 ,
294316 col : 6 ,
317+ rowEnd : undefined ,
318+ colEnd : undefined ,
295319 suffix : {
296320 index : 4 ,
297321 text : '", line 5, col 6'
@@ -318,6 +342,8 @@ suite('TerminalLinkParsing', () => {
318342 suffix : {
319343 row : 5 ,
320344 col : 6 ,
345+ rowEnd : undefined ,
346+ colEnd : undefined ,
321347 suffix : {
322348 index : 10 ,
323349 text : '", line 5, col 6'
@@ -353,6 +379,8 @@ suite('TerminalLinkParsing', () => {
353379 suffix : {
354380 row : 5 ,
355381 col : 6 ,
382+ rowEnd : undefined ,
383+ colEnd : undefined ,
356384 suffix : {
357385 index : 41 ,
358386 text : '", line 5, col 6'
@@ -392,6 +420,8 @@ suite('TerminalLinkParsing', () => {
392420 suffix : {
393421 col : undefined ,
394422 row : 400 ,
423+ rowEnd : undefined ,
424+ colEnd : undefined ,
395425 suffix : {
396426 index : 27 ,
397427 text : ':400'
@@ -446,6 +476,8 @@ suite('TerminalLinkParsing', () => {
446476 suffix : {
447477 col : undefined ,
448478 row : 400 ,
479+ rowEnd : undefined ,
480+ colEnd : undefined ,
449481 suffix : {
450482 index : 1 + osTestPath [ os ] . length ,
451483 text : ':400'
@@ -466,6 +498,8 @@ suite('TerminalLinkParsing', () => {
466498 suffix : {
467499 col : undefined ,
468500 row : 400 ,
501+ rowEnd : undefined ,
502+ colEnd : undefined ,
469503 suffix : {
470504 index : 1 + osTestPath [ os ] . length ,
471505 text : ':400'
@@ -573,7 +607,7 @@ suite('TerminalLinkParsing', () => {
573607 const link2 = testLinksWithSuffix [ i + 1 ] ;
574608 const link3 = testLinksWithSuffix [ i + 2 ] ;
575609 const line = ` ${ link1 . link } ${ link2 . link } ${ link3 . link } ` ;
576- test ( '`' + line + '`' , ( ) => {
610+ test ( '`' + line . replaceAll ( '\u00A0' , '<nbsp>' ) + '`' , ( ) => {
577611 strictEqual ( detectLinks ( line , OperatingSystem . Linux ) . length , 3 ) ;
578612 ok ( link1 . suffix ) ;
579613 ok ( link2 . suffix ) ;
@@ -590,6 +624,8 @@ suite('TerminalLinkParsing', () => {
590624 suffix : {
591625 row : link1 . hasRow ? testRow : undefined ,
592626 col : link1 . hasCol ? testCol : undefined ,
627+ rowEnd : link1 . hasRowEnd ? testRowEnd : undefined ,
628+ colEnd : link1 . hasColEnd ? testColEnd : undefined ,
593629 suffix : {
594630 index : 1 + ( link1 . link . length - link1 . suffix . length ) ,
595631 text : link1 . suffix
@@ -608,6 +644,8 @@ suite('TerminalLinkParsing', () => {
608644 suffix : {
609645 row : link2 . hasRow ? testRow : undefined ,
610646 col : link2 . hasCol ? testCol : undefined ,
647+ rowEnd : link2 . hasRowEnd ? testRowEnd : undefined ,
648+ colEnd : link2 . hasColEnd ? testColEnd : undefined ,
611649 suffix : {
612650 index : ( detectedLink1 . prefix ?. index ?? detectedLink1 . path . index ) + link1 . link . length + 1 + ( link2 . link . length - link2 . suffix . length ) ,
613651 text : link2 . suffix
@@ -626,6 +664,8 @@ suite('TerminalLinkParsing', () => {
626664 suffix : {
627665 row : link3 . hasRow ? testRow : undefined ,
628666 col : link3 . hasCol ? testCol : undefined ,
667+ rowEnd : link3 . hasRowEnd ? testRowEnd : undefined ,
668+ colEnd : link3 . hasColEnd ? testColEnd : undefined ,
629669 suffix : {
630670 index : ( detectedLink2 . prefix ?. index ?? detectedLink2 . path . index ) + link2 . link . length + 1 + ( link3 . link . length - link3 . suffix . length ) ,
631671 text : link3 . suffix
0 commit comments