@@ -122,6 +122,7 @@ suite('fypp Linter integration', () => {
122
122
suite ( 'GNU (gfortran) lint single' , ( ) => {
123
123
const linter = new FortranLintingProvider ( ) ;
124
124
linter [ 'compiler' ] = 'gfortran' ;
125
+ linter [ 'settings' ] [ 'modernGNU' ] = false ;
125
126
const msg = `
126
127
C:\\Some\\random\\path\\sample.f90:4:18:
127
128
@@ -164,6 +165,7 @@ Error: Missing actual argument for argument ‘a’ at (1)
164
165
suite ( 'GNU (gfortran) lint multiple' , ( ) => {
165
166
const linter = new FortranLintingProvider ( ) ;
166
167
linter [ 'compiler' ] = 'gfortran' ;
168
+ linter [ 'settings' ] [ 'modernGNU' ] = false ;
167
169
const msg = `
168
170
/fetch/main/FETCH.F90:1629:24:
169
171
@@ -236,6 +238,7 @@ f951: some warnings being treated as errors
236
238
suite ( 'GNU (gfortran) lint preprocessor' , ( ) => {
237
239
const linter = new FortranLintingProvider ( ) ;
238
240
linter [ 'compiler' ] = 'gfortran' ;
241
+ linter [ 'settings' ] [ 'modernGNU' ] = false ;
239
242
const msg = `
240
243
gfortran: fatal error: cannot execute '/usr/lib/gcc/x86_64-linux-gnu/9/f951': execv: Argument list too long\ncompilation terminated.
241
244
` ;
@@ -277,6 +280,7 @@ gfortran: fatal error: cannot execute '/usr/lib/gcc/x86_64-linux-gnu/9/f951': ex
277
280
suite ( 'GNU (gfortran) lint preprocessor multiple' , ( ) => {
278
281
const linter = new FortranLintingProvider ( ) ;
279
282
linter [ 'compiler' ] = 'gfortran' ;
283
+ linter [ 'settings' ] [ 'modernGNU' ] = false ;
280
284
const msg = `
281
285
f951: Warning: Nonexistent include directory '/Code/TypeScript/vscode-fortran-support/test/fortran/include' [-Wmissing-include-dirs]
282
286
/Code/TypeScript/vscode-fortran-support/test/fortran/sample.f90:4:18:
@@ -341,6 +345,131 @@ Error: Missing actual argument for argument 'a' at (1)
341
345
deepStrictEqual ( matches , ref ) ;
342
346
} ) ;
343
347
} ) ;
348
+ suite ( 'GNU (gfortran v11+) lint single plain output' , ( ) => {
349
+ const linter = new FortranLintingProvider ( ) ;
350
+ linter [ 'compiler' ] = 'gfortran' ;
351
+ linter [ 'settings' ] [ 'modernGNU' ] = true ;
352
+ const msg = `err-mod.f90:3:17: Error: (1)` ;
353
+ suite ( 'REGEX matches' , ( ) => {
354
+ const regex = linter [ 'getCompilerREGEX' ] ( linter [ 'compiler' ] ) ;
355
+ const matches = [ ...msg . matchAll ( regex ) ] ;
356
+ const g = matches [ 0 ] . groups ;
357
+ test ( 'REGEX: filename' , ( ) => {
358
+ strictEqual ( g ?. [ 'fname' ] , 'err-mod.f90' ) ;
359
+ } ) ;
360
+ test ( 'REGEX: line number' , ( ) => {
361
+ strictEqual ( g ?. [ 'ln' ] , '3' ) ;
362
+ } ) ;
363
+ test ( 'REGEX: column number' , ( ) => {
364
+ strictEqual ( g ?. [ 'cn' ] , '17' ) ;
365
+ } ) ;
366
+ test ( 'REGEX: severity <sev>' , ( ) => {
367
+ strictEqual ( g ?. [ 'sev' ] , 'Error' ) ;
368
+ } ) ;
369
+ test ( 'REGEX: message <msg>' , ( ) => {
370
+ strictEqual ( g ?. [ 'msg' ] , '(1)' ) ;
371
+ } ) ;
372
+ } ) ;
373
+ test ( 'Diagnostics Array' , ( ) => {
374
+ const matches = linter [ 'parseLinterOutput' ] ( msg ) ;
375
+ const ref = [
376
+ new Diagnostic (
377
+ new Range ( new Position ( 2 , 17 ) , new Position ( 2 , 17 ) ) ,
378
+ '(1)' ,
379
+ DiagnosticSeverity . Error
380
+ ) ,
381
+ ] ;
382
+ deepStrictEqual ( matches , ref ) ;
383
+ } ) ;
384
+ } ) ;
385
+ suite ( 'GNU (gfortran v11+) lint multiple plain output' , ( ) => {
386
+ const linter = new FortranLintingProvider ( ) ;
387
+ linter [ 'compiler' ] = 'gfortran' ;
388
+ linter [ 'settings' ] [ 'modernGNU' ] = true ;
389
+ const msg = `
390
+ err-mod.f90:3:17: Error: (1)
391
+ err-mod.f90:2:11: Error: IMPLICIT NONE statement at (1) cannot follow PRIVATE statement at (2)
392
+ err-mod.f90:10:22: Error: Missing actual argument for argument ‘arg1’ at (1)` ;
393
+ suite ( 'REGEX matches' , ( ) => {
394
+ const regex = linter [ 'getCompilerREGEX' ] ( linter [ 'compiler' ] ) ;
395
+ const matches = [ ...msg . matchAll ( regex ) ] ;
396
+ const g = matches [ 0 ] . groups ;
397
+ test ( 'REGEX: filename' , ( ) => {
398
+ strictEqual ( g ?. [ 'fname' ] , 'err-mod.f90' ) ;
399
+ } ) ;
400
+ test ( 'REGEX: line number' , ( ) => {
401
+ strictEqual ( g ?. [ 'ln' ] , '3' ) ;
402
+ } ) ;
403
+ test ( 'REGEX: column number' , ( ) => {
404
+ strictEqual ( g ?. [ 'cn' ] , '17' ) ;
405
+ } ) ;
406
+ test ( 'REGEX: severity <sev>' , ( ) => {
407
+ strictEqual ( g ?. [ 'sev' ] , 'Error' ) ;
408
+ } ) ;
409
+ test ( 'REGEX: message <msg>' , ( ) => {
410
+ strictEqual ( g ?. [ 'msg' ] , '(1)' ) ;
411
+ } ) ;
412
+
413
+ const g2 = matches [ 1 ] . groups ;
414
+ test ( 'REGEX: filename' , ( ) => {
415
+ strictEqual ( g2 ?. [ 'fname' ] , 'err-mod.f90' ) ;
416
+ } ) ;
417
+ test ( 'REGEX: line number' , ( ) => {
418
+ strictEqual ( g2 ?. [ 'ln' ] , '2' ) ;
419
+ } ) ;
420
+ test ( 'REGEX: column number' , ( ) => {
421
+ strictEqual ( g2 ?. [ 'cn' ] , '11' ) ;
422
+ } ) ;
423
+ test ( 'REGEX: severity <sev>' , ( ) => {
424
+ strictEqual ( g2 ?. [ 'sev' ] , 'Error' ) ;
425
+ } ) ;
426
+ test ( 'REGEX: message <msg>' , ( ) => {
427
+ strictEqual (
428
+ g2 ?. [ 'msg' ] ,
429
+ 'IMPLICIT NONE statement at (1) cannot follow PRIVATE statement at (2)'
430
+ ) ;
431
+ } ) ;
432
+
433
+ const g3 = matches [ 2 ] . groups ;
434
+ test ( 'REGEX: filename' , ( ) => {
435
+ strictEqual ( g3 ?. [ 'fname' ] , 'err-mod.f90' ) ;
436
+ } ) ;
437
+ test ( 'REGEX: line number' , ( ) => {
438
+ strictEqual ( g3 ?. [ 'ln' ] , '10' ) ;
439
+ } ) ;
440
+ test ( 'REGEX: column number' , ( ) => {
441
+ strictEqual ( g3 ?. [ 'cn' ] , '22' ) ;
442
+ } ) ;
443
+ test ( 'REGEX: severity <sev>' , ( ) => {
444
+ strictEqual ( g3 ?. [ 'sev' ] , 'Error' ) ;
445
+ } ) ;
446
+ test ( 'REGEX: message <msg>' , ( ) => {
447
+ strictEqual ( g3 ?. [ 'msg' ] , 'Missing actual argument for argument ‘arg1’ at (1)' ) ;
448
+ } ) ;
449
+ } ) ;
450
+
451
+ test ( 'Diagnostics Array' , ( ) => {
452
+ const matches = linter [ 'parseLinterOutput' ] ( msg ) ;
453
+ const ref = [
454
+ new Diagnostic (
455
+ new Range ( new Position ( 2 , 17 ) , new Position ( 2 , 17 ) ) ,
456
+ '(1)' ,
457
+ DiagnosticSeverity . Error
458
+ ) ,
459
+ new Diagnostic (
460
+ new Range ( new Position ( 1 , 11 ) , new Position ( 1 , 11 ) ) ,
461
+ 'IMPLICIT NONE statement at (1) cannot follow PRIVATE statement at (2)' ,
462
+ DiagnosticSeverity . Error
463
+ ) ,
464
+ new Diagnostic (
465
+ new Range ( new Position ( 9 , 22 ) , new Position ( 9 , 22 ) ) ,
466
+ 'Missing actual argument for argument ‘arg1’ at (1)' ,
467
+ DiagnosticSeverity . Error
468
+ ) ,
469
+ ] ;
470
+ deepStrictEqual ( matches , ref ) ;
471
+ } ) ;
472
+ } ) ;
344
473
345
474
// -----------------------------------------------------------------------------
346
475
0 commit comments