@@ -347,6 +347,72 @@ foo()
347347 test ( 'supports more than 1000 lines' , ( ) => {
348348 expectSnapshot ( generateCodeFrame ( veryLongSource , { line : 1200 , column : 0 } ) )
349349 } )
350+
351+ test ( 'long line (start)' , ( ) => {
352+ const longLine = 'a' . repeat ( 60 ) + 'b' . repeat ( 60 ) + 'c' . repeat ( 60 )
353+ const src = `${ longLine } \nshort line\n${ longLine } `
354+ const frame = generateCodeFrame (
355+ src ,
356+ { line : 1 , column : 0 } ,
357+ { line : 1 , column : 30 } ,
358+ )
359+ expectSnapshot ( frame )
360+ } )
361+
362+ test ( 'long line (center)' , ( ) => {
363+ const longLine = 'a' . repeat ( 60 ) + 'b' . repeat ( 60 ) + 'c' . repeat ( 60 )
364+ const src = `${ longLine } \nshort line\n${ longLine } `
365+ const frame = generateCodeFrame (
366+ src ,
367+ { line : 1 , column : 90 } ,
368+ { line : 1 , column : 120 } ,
369+ )
370+ expectSnapshot ( frame )
371+ } )
372+
373+ test ( 'long line (end)' , ( ) => {
374+ const longLine = 'a' . repeat ( 60 ) + 'b' . repeat ( 60 ) + 'c' . repeat ( 60 )
375+ const src = `${ longLine } \nshort line\n${ longLine } `
376+ const frame = generateCodeFrame (
377+ src ,
378+ { line : 1 , column : 150 } ,
379+ { line : 1 , column : 180 } ,
380+ )
381+ expectSnapshot ( frame )
382+ } )
383+
384+ test ( 'long line (whole)' , ( ) => {
385+ const longLine = 'a' . repeat ( 60 ) + 'b' . repeat ( 60 ) + 'c' . repeat ( 60 )
386+ const src = `${ longLine } \nshort line\n${ longLine } `
387+ const frame = generateCodeFrame (
388+ src ,
389+ { line : 1 , column : 0 } ,
390+ { line : 1 , column : 180 } ,
391+ )
392+ expectSnapshot ( frame )
393+ } )
394+
395+ test ( 'long line (multiline 1)' , ( ) => {
396+ const longLine = 'a' . repeat ( 60 ) + 'b' . repeat ( 60 ) + 'c' . repeat ( 60 )
397+ const src = `${ longLine } \nshort line\n${ longLine } `
398+ const frame = generateCodeFrame (
399+ src ,
400+ { line : 1 , column : 170 } ,
401+ { line : 2 , column : 5 } ,
402+ )
403+ expectSnapshot ( frame )
404+ } )
405+
406+ test ( 'long line (multiline 2)' , ( ) => {
407+ const longLine = 'a' . repeat ( 60 ) + 'b' . repeat ( 60 ) + 'c' . repeat ( 60 )
408+ const src = `${ longLine } \nshort line\n${ longLine } `
409+ const frame = generateCodeFrame (
410+ src ,
411+ { line : 2 , column : 5 } ,
412+ { line : 3 , column : 30 } ,
413+ )
414+ expectSnapshot ( frame )
415+ } )
350416} )
351417
352418describe ( 'getHash' , ( ) => {
0 commit comments