Skip to content

Commit 048e850

Browse files
committed
test(coverage): enable logging lines
1 parent 4b9f848 commit 048e850

File tree

3 files changed

+21
-8
lines changed

3 files changed

+21
-8
lines changed

test/formatting-provider.test.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,16 @@ import { strictEqual } from 'assert';
22
import { FortranFormattingProvider } from '../src/features/formatting-provider';
33
import * as vscode from 'vscode';
44
import * as path from 'path';
5-
import { Logger } from '../src/services/logging';
5+
import { Logger, LogLevel } from '../src/services/logging';
6+
7+
const logger = new Logger(
8+
vscode.window.createOutputChannel('Modern Fortran', 'log'),
9+
LogLevel.DEBUG
10+
);
611

712
suite('Formatting tests', () => {
813
let doc: vscode.TextDocument;
9-
const fmt = new FortranFormattingProvider(new Logger());
14+
const fmt = new FortranFormattingProvider(logger);
1015
const fileUri = vscode.Uri.file(
1116
path.resolve(__dirname, '../../test/fortran/format/formatting_test.f90')
1217
);
@@ -18,7 +23,7 @@ suite('Formatting tests', () => {
1823
});
1924

2025
test('Using findent', async () => {
21-
const fmt = new FortranFormattingProvider(new Logger());
26+
const fmt = new FortranFormattingProvider(logger);
2227
fmt['formatter'] = 'findent';
2328
const edits = await fmt['doFormatFindent'](doc);
2429
strictEqual(

test/linter-provider.test.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,13 @@ import {
2121
LFortranLinter,
2222
} from '../src/lib/linters';
2323
import { EXTENSION_ID, pipInstall } from '../src/lib/tools';
24+
import { Logger, LogLevel } from '../src/services/logging';
25+
26+
const logger = new Logger(window.createOutputChannel('Modern Fortran', 'log'), LogLevel.DEBUG);
2427

2528
suite('Linter integration', () => {
2629
let doc: TextDocument;
27-
const linter = new FortranLintingProvider();
30+
const linter = new FortranLintingProvider(logger);
2831
const fileUri = Uri.file(path.resolve(__dirname, '../../test/fortran/lint/test1.f90'));
2932
const root = path.resolve(__dirname, '../../test/fortran/');
3033
const config = workspace.getConfiguration(EXTENSION_ID);
@@ -37,7 +40,7 @@ suite('Linter integration', () => {
3740
// different versions of gfortran report the error at a different column number
3841
// need to implement a the compiler versioning see #523
3942
test('GNU - API call to doLint produces correct diagnostics', async () => {
40-
const diags = await new FortranLintingProvider()['doLint'](doc);
43+
const diags = await new FortranLintingProvider(logger)['doLint'](doc);
4144
const ref: Diagnostic[] = [
4245
new Diagnostic(
4346
new Range(new Position(21 - 1, 18 - 1), new Position(21 - 1, 18 - 1)),
@@ -123,7 +126,7 @@ suite('fypp Linter integration', () => {
123126
const doc = await workspace.openTextDocument(fileUri);
124127
await window.showTextDocument(doc);
125128

126-
const diags = await new FortranLintingProvider()['doLint'](doc);
129+
const diags = await new FortranLintingProvider(logger)['doLint'](doc);
127130
const refs: Diagnostic[] = [
128131
new Diagnostic(
129132
new Range(new Position(18, 35), new Position(18, 35)),

test/lsp-client.test.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
import * as vscode from 'vscode';
22
import * as path from 'path';
33
import { strictEqual } from 'assert';
4-
import { Logger } from '../src/services/logging';
54
import { FortlsClient } from '../src/lsp/client';
65
import { delay } from '../src/lib/helper';
6+
import { Logger, LogLevel } from '../src/services/logging';
7+
8+
const logger = new Logger(
9+
vscode.window.createOutputChannel('Modern Fortran', 'log'),
10+
LogLevel.DEBUG
11+
);
712

813
suite('Language Server integration tests', () => {
914
let doc: vscode.TextDocument;
10-
const server = new FortlsClient(new Logger());
15+
const server = new FortlsClient(logger);
1116
const fileUri = vscode.Uri.file(
1217
path.resolve(__dirname, '../../test/fortran/function_subroutine_definitions.f90')
1318
);

0 commit comments

Comments
 (0)